Using XML to implement universal web report printing (2)

xiaoxiao2021-03-06  78

Substancy and safety

Scalability

Since the XML standard data format is used as an intermediate data exchange, this solution has very good scalability, for example, the client's .NET control can be directly replaced by Java Applet, ActivX or VB, VC, etc. . The server can also be arbitrarily selected by IIS or APACHE and other web servers. A database can also be used in any database. Includes SQL Server, Oracle or Access, etc.. This above has already talked, because the length of the article does not make the T-shirt that is given to me, and then emphasizes it just to deepen the readers' cross-platform understanding of XML. :)

safety

Since the normal web server transmits data, it can be directly adopted by SSL security sockets and other already mature web encryption techniques. At the same time, XML can be encrypted on the data algorithm, and decrypt the client to ensure the security of the transmission.

Since the 80-port is used, it is not necessary to add another new dedicated port, which reduces the possibility of security vulnerabilities, and it can easily pass the network firewall and other protective equipment for both parties.

Program design

Format definition

In order to control the format of printing, we define the following format tags, which refer to HTML naming methods, so it is basically familiar with HTML to see the specific meaning of the label. If you think that these tags have not strong enough, you can also define some more and more precise format tags.

Label application example:

true A4 210 297 0 0 0 0 latest transaction contract information Tabulation time: "Y =" 100 "fontname =" "" Y = "100" FontName = " Song "FontSize =" 12 "fontcolor =" black "b =" true "i =" false "u =" true "> unit: element

contract number Product Name < Td width = "50" align = "center" fontname = "Song" fontsize = "12" fontcolor = "black" b = "true" i = "false" u = "false" bgcolor = "white"> transaction volume < / TD> Transaction price Transaction amount Harmoned amount starting price seller Buyer
20021010015 CNR 93 < Td width = "70" align = "left" fontname = "Song" fontsize = "12" fontcolor = "black" b = "true" i = "false" u = "false" BGColor = "White"> 6680 621240 93 6680 Hubei Province State New Star Tractor Factory Zhonghua International Trade Co., Ltd. ......... Note:

a) If the server script dynamically generates an XML document, the sending content type should be set to Text / XML (the normal HTML page is TEXT / HTML), and the character encoding should be UTF-8, otherwise the encoding error problem will occur.

b) The file should be generated in strict accordance with the format specified in XML, otherwise the XML parser will not be parsed.

2. Client

You can use any application to read the XML file generated by the server. If you use the desktop application software development tools such as VB, Delphi, you can use the MSXML COM parser. It is recommended to use .NET, the interior has integrated XML parser, which can be used directly by using the .NET class library. You can make both desktop applications, via remote calls; can also be embedded in the IE browser, running directly on the web page.

Example diagram

Printing preview

Precautions:

1. If you use .NET, the client must install .NET Framework1.0 running environment, download address is: http://download/.netframesdk/redist/1.0/w98nt42kmexp/en-us/dotnetredist .exe2. If you are embedded in the form of a web page, then this program needs to be compiled into a control form (an extension DLL file), then insert the following tag in the web page:

Embed controls into a static or dynamic web page. The control file is then copied to the same directory as the web page (the control file name generated in the tag, which is namedpace name for this control).

转载请注明原文地址:https://www.9cbs.com/read-122898.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.034, SQL: 9