Solution (a) to achieve a Word document reports in text mode,

      In China, a table (not very specifications table) Word document form is very much in daily use in the development of applications, a majority is making good a form as a module, and then to fill in the template are different data records . Our process can be carried out directly by WordAppliction development, but you must install Office, especially in the development of B / S, the server calls WordAppliction more than a good solution, the development of a more cumbersome plus cumbersome approach. Point system resources do not say, can lead to system instability (concurrent calls Word not tested). Therefore, in the actual development, the urgent need to look elsewhere for a better solution.

      The company's new project is a lot of places to use this system of irregular form, which prompted me to complete this development, there are many features of the development of the Office to be done, especially Excel section is absolutely no development, so now has the Word of the completed application released, the other is willing to needy comrades with reference details to the Office application that a better development, we can reduce the duplication of development troubles, I can get better learning in all studies. (The tall classmate Raymond Wong God, he gave the idea as text, so I have little detour)

       In .net, Framework4.0 provides Office2007 development package, including Word and Excel calls and other functions, but do not know if this document is converted to Office2003 function (not for research in this area), after all Office2007 a Zip file compression, a new standards-based specification of the Office XML documents is also not a lot of research, I believe that to be familiar with the development kit, have a lot of time, but also for my program (refer to Word documents, Excel documents like use .net development package better point) is not much help, so I chose Word2003 way to save XML report as a template, generate a report after a successful return is a text stream, developers can be saved as a suffix to the user with a .DOC , you can directly use the open Office documents.

Here to talk about the specific implementation steps:

       This embodiment with reference to a reference VBA art related programming languages the DSL ( the Domain-Specific Languages ) is thought, by setting the relevant equation (function) in the text, the system automatically converts the corresponding data according to the equation, corresponding to very high Find and replace.

       1, the use of XML as a way to save the Word document. Office2007 in doc document is an XML specification to save, Office2003 saved XML document specification, easy to explain, in the form of Html than save a lot better, so the program uses the XML documents will be stored for development.

       2, to achieve universal, easy to use, the program is fool-use for developers, the program only provides a simple interface for developers all the real work is in the design template (ie DSL language learning), programs It requires only a transmission entity or a collection entity and the template name specified program is output (type of entity may be anonymous, i.e. requiring a strong entity type) according to the reporting entity conversion, because it is controlled by the output of a specific template , issued by the developers do not need to pre-arrange the output. So basically able to meet all of the Word reports.

      3, easy to expand. The program is designed and implemented very type formula, you can solve most of the demand, if demand expansion, from FormulaUtility extension methods, are interested in the class can be made in the form of plug-ins, the program loads the plug-in can be achieved specific needs.

 

Please indicate the source http://www.cnblogs.com/Yjianyong/archive/2011/01/10/1931132.html

       Here this issue, expected continued ......

Reproduced in: https: //www.cnblogs.com/Yjianyong/archive/2011/01/10/1931132.html

Guess you like

Origin blog.csdn.net/weixin_33795093/article/details/94199559