CN104572048A - XML-based EXCEL report generation method in JSP environment - Google Patents

XML-based EXCEL report generation method in JSP environment Download PDF

Info

Publication number
CN104572048A
CN104572048A CN201310489798.6A CN201310489798A CN104572048A CN 104572048 A CN104572048 A CN 104572048A CN 201310489798 A CN201310489798 A CN 201310489798A CN 104572048 A CN104572048 A CN 104572048A
Authority
CN
China
Prior art keywords
xml
jsp
excel
data
generation method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310489798.6A
Other languages
Chinese (zh)
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd
Original Assignee
ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd filed Critical ZHENJIANG DINGTUO TECHNOLOGY INFORMATION Co Ltd
Priority to CN201310489798.6A priority Critical patent/CN104572048A/en
Publication of CN104572048A publication Critical patent/CN104572048A/en
Pending legal-status Critical Current

Links

Abstract

The invention relates to an XML-based EXCEL report generation method in a JSP environment. The method is an XML-based EXCEL report implementation manner under the JSP language environment. The report implementation manner utilizes the feature that XML data and format are separated and the strong and rich format control and data processing ability of EXCEL. By the method, programming can be simplified, and development difficulty and cost are lowered. Compared with other EXCEL report generation methods, the method has the advantage that the flexibility and controllability of the method are increased greatly.

Description

Based on the EXCEL report form generation method of XML in a kind of JSP environment
Technical field
Being existing based on stopping of the form dynamically generated in JSP linguistic based on the EXCEL report form generation method of XML in a kind of JSP environment, is the applying portion in computer realm.
Background technology
Along with the acceleration of the Process of Enterprise Informalization, Manufacturing Executive System MES (Manufacturing Execution System) obtains apply more and more widely with enterprise resource manage system (Enterprise Resource Planning).In the middle of these systematic difference, report printing function is wherein one of requisite function, because form is as a kind of important information carrier, and the irreplaceable effect of the person of plaing in the middle of the information management, statistical study of enterprise.And in the application system of any one enterprise, Problem of Report also one of them difficult point often, especially in the middle of the system of systems constructed based on JSP language.Such as in the middle of the Information-based Item performance history that this bears certain steel mill, manufacturer just needs to realize so a kind of reporting system, and concrete condition is:
1) the mechanical property raw data of steel is positioned in the middle of SQLSERVER 2000 database, will wherein some statistical conversion time, need to require to carry out computing to raw data wherein according to different analytic statisticss, then by the data genaration initiating electron data sheet after computing, can be with function representation: Yij=F (Xij), Yij is the data of electronic report forms cell, and Xij is the original mechanical performance data in SQLSERVER2000 database, and F is mapping relations.
2) data of electronic report forms also likely need to carry out secondary conventional processing with information analysis and final printing reports according to different.
3) spreadsheet report pattern need meet the report style of these factory's internal rules, can oneself define.
According to above-mentioned requirements, it is most suitable that the raw data in database is generated EXCEL file after calculating.So just can control and data-handling capacity by powerful by Excel, abundant form, the requirement that user freely defines report style and data carried out to secondary treating can be met.Both to some extent solved the flexibility problem of form, and in turn saved many development amounts, reduce the scale of program design, simplify the maintenance of program, thus substantially increase the efficiency of system development.And as the widely used software of one, also there is not train problems in EXCEL.In JSP environment, several conventional method below is in general had to generate Excel file.The storing process utilizing SQLSERVER to carry is derived and is generated EXCEL file.Simple and convenient but the very flexible of the method, can not define statement form in advance, and as header area, gauge outfit district, table tail region etc., need to revise afterwards again, define its report style, post-processed is cumbersome.And manufacturer requires that the report data generated needs through intermediate treatment, so method can not meet the demands.2, utilize third party can generate the plug-in unit of EXCEL.Shortcoming is pin function general finite, can not meet special requirement, and generally will charge, and can not, well for B/S structure, need extra time study to understand pin function in addition.Consider the demand of system and we determine that oneself exploitation is used for generating the program of EXCEL file after careful research, because so i.e. economy but also facilitate, be most suitable method under the prerequisite meeting system requirements.
Summary of the invention
An a kind of EXCEL report form generation method of base XML in JSP environment, the XML format of first carrying out EXCEL is resolved; Form is generally decomposed into header area, gauge outfit district, table tagma and table tail region, also the content of form can be divided into two parts:
(1) static description part (header area, gauge outfit district and table tail region): static description has partly defined at statement form
After be constant, as the size of font, whether font has underscore, and be single underscore or double underline, whether font has
Subscript or subscript, font is left-justify, Right Aligns or placed in the middle etc.
(2) dynamic data filling part (table tagma): this be report data present part, be the core of whole form.
Any one EXCEL file newly-built, after the form of the corresponding format that completes, saves as XML file wherein, like this
Just obtain the xml code of EXCEL file.
As this section of xml code describes the essential information of EXCEL file below, as version, creation-time, author, pattern letter
Breath, last holding time etc., for the static state of form describes part.
<xml version="1.0">
<mso-application progid="Excel.Sheet">
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
42Z</Created>
<LastSaved>2007-03-10T02:07:25Z</LastSaved>
<Version>11.6360</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<RemovePersonalInformation/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>4530</WindowHeight>
<WindowWidth>8505</WindowWidth>
<WindowTopX>480</WindowTopX>
<WindowTopY>120</WindowTopY>
<AcceptLabelsInFormulas/>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName=" Song typeface " x:CharSet=" 134 " ss:Size=" 12 "/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
And one section of xml code below describes the situation of this Zhang Gong's tabulation of sheet1, for dynamic data describes part.Wherein
Xml code describe the line number of this worksheet, columns, the height of cell and width, and the Table Header information in table tagma
With data message etc. in table.
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="3" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="14.25">
<Row>
<Cell><Data ss:Type=" String " > first row </Data></CellGre atT.GreaT.GT
<Cell><Data ss:Type=" String " > secondary series </Data></CellGre atT.GreaT.GT
<Cell><Data ss:Type=" String " > the 3rd arranges </Data></CellGre atT.GreaT.GT
<Cell><Data ss:Type=" String " > the 4th arranges </Data></CellGre atT.GreaT.GT
</Row>
<Row>
<Cell><Data ss:Type="Number">1</Data></Cell>
<Cell><Data ss:Type="Number">2</Data></Cell>
<Cell><Data ss:Type="Number">3</Data></Cell>
<Cell><Data ss:Type="Number">4</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">a</Data></Cell>
<Cell><Data ss:Type="String">b</Data></Cell>
<Cell><Data ss:Type="String">c</Data></Cell>
<Cell><Data ss:Type="String">d</Data></Cell>
</Row>
</Table>
2. by analysis to XML structure, in time will creating such EXCEL form, just relatively easy.After report style is determined, static description part is changeless, therefore exports as it is, if as required by programming well corresponding multidate information just can generate the file of XML format.Such as change the <Row> not adding runic of Dynamic profiling part ... namely </Row> part changes the gauge outfit that sheet 1 shows tagma, and change adds the <Row> of bolded section ... </Row> and line number descriptor can increase/reduce, the data message in change table tagma.Here is the JSPbean creation procedure framework of an XML file:
package reportdata;
import JSP.io.*;
import JSP.io.FileOutputStream;
public class CreateExcel {
String str="";
Int sheet1rowcount=8; Total line number of //sheet1
Int sheet2rowcount=5; Total line number of //sheet2
Int sheet3rowcount=4; Total line number of //sheet3
Public CreateExcel () { // building method }
Public String createHead () // create the static descriptor in top }
Public String createsheet1 () // create sheet 1 to show
Public String createsheet 2 () // create sheet 2 to show
Public String createsheet 3 () // create sheet 3 to show
Public String createBottom () // create the static descriptor in bottom }
By above analysis, can FOUR EASY STEPS be divided into: the first step, required raw data is taken out from database; Second step, processes (realizing computation process by JSP program) to raw data and is converted to XML information format; 3rd step, utilizes XML character stream to generate XML file; 4th step, is converted to formal EXCEL report file.
After generation XML data file, because it has been a document data bank, therefore can carries out off-line operation, which reduces network traffics, improve system effectiveness.

Claims (10)

1. in a JSP environment based on the EXCEL report form generation method of XML: the method mainly by right XML format resolve automatic report generation.
2. in JSP environment according to claim 1 based on the EXCEL report form generation method of XML, its principal character is: the XML format of EXCEL is resolved, form is generally decomposed into header area, gauge outfit district, table tagma and table tail region, also the content of form can be divided into two parts.
3. in JSP environment according to claim 2 based on the EXCEL report form generation method of XML, its static description part (header area, gauge outfit district and table tail region): static description part is constant after statement form has defined, as the size of font, whether font has underscore, single underscore or double underline, whether font has subscript or subscript, and font is left-justify, Right Aligns or placed in the middle etc.
4. in JSP environment according to claim 2 based on the EXCEL report form generation method of XML, its dynamic data filling part (table tagma): this be report data present part, be the core of whole form.
5. in JSP environment according to claim 2 based on the EXCEL report form generation method of XML, according to the object point of its outside, generate specific XML format.
6., according to claim 5, its JSPbean creation procedure framework, generates specific XML.
7., according to claim 6, required raw data is taken out from database and reads its data stream.
8., according to claim 7, (realizing computation process by JSP program) is processed to raw data and is converted to XML information format.
9. according to Claim 8, utilize XML character stream to generate the XML file of specific JSP form.
10., according to claim 9, during display statement form, be converted to formal EXCEL report file.
CN201310489798.6A 2013-10-18 2013-10-18 XML-based EXCEL report generation method in JSP environment Pending CN104572048A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310489798.6A CN104572048A (en) 2013-10-18 2013-10-18 XML-based EXCEL report generation method in JSP environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310489798.6A CN104572048A (en) 2013-10-18 2013-10-18 XML-based EXCEL report generation method in JSP environment

Publications (1)

Publication Number Publication Date
CN104572048A true CN104572048A (en) 2015-04-29

Family

ID=53088223

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310489798.6A Pending CN104572048A (en) 2013-10-18 2013-10-18 XML-based EXCEL report generation method in JSP environment

Country Status (1)

Country Link
CN (1) CN104572048A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302788A (en) * 2015-11-10 2016-02-03 百度在线网络技术(北京)有限公司 Method and device for editing table
CN105354240A (en) * 2015-10-14 2016-02-24 金蝶软件(中国)有限公司 Report file processing method and apparatus
CN106874247A (en) * 2017-01-03 2017-06-20 北京神州绿盟信息安全科技股份有限公司 A kind of report form generation method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122899A (en) * 2007-09-18 2008-02-13 杭州华三通信技术有限公司 Report generation method and device
CN101650711A (en) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 Method for generating report
CN102156741A (en) * 2011-04-16 2011-08-17 武钢集团昆明钢铁股份有限公司 Custom dynamic report system and implementation method thereof
US20130054221A1 (en) * 2011-08-31 2013-02-28 International Business Machines Corporation Generating specifications for expression language expressions and tag libraries
CN103294691A (en) * 2012-02-24 2013-09-11 镇江华扬信息科技有限公司 XML (extensive makeup language)-based EXCEL report generation method in JAVA environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122899A (en) * 2007-09-18 2008-02-13 杭州华三通信技术有限公司 Report generation method and device
CN101650711A (en) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 Method for generating report
CN102156741A (en) * 2011-04-16 2011-08-17 武钢集团昆明钢铁股份有限公司 Custom dynamic report system and implementation method thereof
US20130054221A1 (en) * 2011-08-31 2013-02-28 International Business Machines Corporation Generating specifications for expression language expressions and tag libraries
CN103294691A (en) * 2012-02-24 2013-09-11 镇江华扬信息科技有限公司 XML (extensive makeup language)-based EXCEL report generation method in JAVA environment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354240A (en) * 2015-10-14 2016-02-24 金蝶软件(中国)有限公司 Report file processing method and apparatus
CN105354240B (en) * 2015-10-14 2019-09-06 金蝶软件(中国)有限公司 Report file treating method and apparatus
CN105302788A (en) * 2015-11-10 2016-02-03 百度在线网络技术(北京)有限公司 Method and device for editing table
CN105302788B (en) * 2015-11-10 2018-07-13 百度在线网络技术(北京)有限公司 Method and device for editing table
CN106874247A (en) * 2017-01-03 2017-06-20 北京神州绿盟信息安全科技股份有限公司 A kind of report form generation method and device

Similar Documents

Publication Publication Date Title
CN103294691A (en) XML (extensive makeup language)-based EXCEL report generation method in JAVA environment
CN101359290A (en) Method for customizing service document based on metadata and apparatus
CN102156741A (en) Custom dynamic report system and implementation method thereof
CN101436185B (en) Method for implementing multiple-file compatibility by XML memory tree
JP2015504213A5 (en)
CN103077185A (en) Object-based user-defined information-expanding method
CN103428080A (en) Data unpacking and data packing method
CN103218448A (en) Self-service report generating method, device and system
CN104572048A (en) XML-based EXCEL report generation method in JSP environment
CN105069116A (en) Method and system for converting json string into array
US9652478B2 (en) Method and apparatus for generating an electronic document schema from a relational model
Tarasyuk et al. Discrete time stochastic Petri box calculus with immediate multiactions
CN102541811A (en) On-demand computing-based data analysis device and method for analysis factors
CN106095754A (en) A kind of medical terminology dictionary part-of-speech tagging method
CN107632831B (en) Method and device for quickly standardizing front-end codes
JP2008052356A (en) Source code automatic generation device
CN102486731A (en) Method, device and system for enhancing visualization of software call stack of software
CN107544947A (en) One kind is based on XML language EXCEL report form generation methods
CN101587470B (en) Document compiling method and device
CN102663040A (en) Method for obtaining attribute column weights based on KL (Kullback-Leibler) divergence training for positive-pair and negative-pair constrained data
Buster et al. GOOML Big Kahuna Forecast Modeling and Genetic Optimization Files
Altiparmak et al. Source code generation for large scale applications
Li et al. The research and application of web page code automatic generation technology
CN103092940A (en) File structure, digital signature method and digital signature validation method with verifiable reconfiguration
CN100426731C (en) An output analysis method of two dimensional table in man machine command

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150429