Application of the Bridge Mode in the Report System

Source: Internet
Author: User

The report system is an important part of the information system. When preparing a report system, we want the report builder to be separated from the logical part of the report,
In this way, no matter what report output technology is used, the business logic is not affected. For example, when outputting reports, users often want to be compatible with MS Office,
The report is output to MS Excel or MS Word, and the upgrade of the office system will lead to the upgrade of the report system,
To improve the adaptability of the application system, the bridge mode can be used to reduce the impact of MS Office software upgrade on the system.

Using system;
Using system. collections;
Using system. Data;
Using system. Drawing. drawing2d;
Using system. drawing;


Namespace reportbridge
...{
Public interface hreport
...{
Void writetitle (String title );
Void writeauthor (string author );
Void writehead (arraylist H );
Void writecontent (Dataset DS );
}

Public interface reportwriter
...{
Void newreport (string filename );
Void write (INT Col, int row, string cotent, font F, color C );
Void savereport ();
}

Public class report: hreport
...{
Private reportwriter m_writer;

Public Report (reportwriter t_rw)
...{
M_writer = t_rw;
}


Hreport member # region hreport Member

Public void writetitle (String title)
...{
// Todo: Add Report. writetitle implementation
}

Public void writeauthor (string author)
...{
// Todo: Add Report. writeauthor implementation
}

Public void writehead (arraylist H)
...{
// Todo: Add Report. writehead implementation
}

Public void writecontent (Dataset DS)
...{
// Todo: Add Report. writecontent implementation
}

# Endregion

}


Public class BMP reportwriter: reportwriter
...{
Reportwriter member # region reportwriter Member

Public void newreport (string filename)
...{
// Todo: Add BMP reportwriter. newreport implementation
}

Public void write (INT Col, int row, string cotent, font F, color C)
...{
// Todo: add the BMP reportwriter. Write implementation
}

Public void savereport ()
...{
// Todo: add the BMP reportwriter. savereport implementation
}

# Endregion

}

Public class excelreportwriter: reportwriter
...{
Reportwriter member # region reportwriter Member

Public void newreport (string filename)
...{
// Todo: Add excelreportwriter. newreport implementation
}

Public void write (INT Col, int row, string cotent, font F, color C)
...{
// Todo: Add excelreportwriter. Write implementation
}

Public void savereport ()
...{
// Todo: Add excelreportwriter. savereport implementation
}

# Endregion

}

Public class invoker
...{
Public void run ()
...{
BMP reportwriter m_brw = new BMP reportwriter ();
Hreport M_r = new report (m_brw );
M_r.writeauthor ("myauthor ");


}
}
 
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.