China table cell application-use XML to automatically read data | # Report # China table cell

Source: Internet
Author: User

 

In the Huawei table cell application-in IE, the Huawei table cell plug-in uses hard coding to add data to reports, which is time-consuming and labor-consuming. In fact, there is another method, is to use XML to automatically fill in data.

 

To fill in data in the XML format, you need to convert the XML data document in the recommended format of the Chinese table, read the XML content through Ajax, and fill the data using the readfromxml (xmlstr) method.

From "cell plug-in help. chm"
Readfromxml Method

Read the XML string of the cell table in XML format into the cell Table Page.

[Visual Basic]ReadFromXML(strxml As String) As Boolean
Return Value:
> 0. The operation is successful.
<= 0 this operation failed.
Parameters
Strxml
XML string of the cell table
Note

This method is a plug-in method.

(If Table store supports reading XML data directly from a specified URL, it would be nice to save writing Ajax by yourself .)

 

For example, the data in the preceding example can be replaced by the following XML file:

 

Data. xml 

<? XML version = "1.0" encoding = "UTF-8"?>

<Workbook>

<Documentproperties>

<Created> 2010-03-18t00: 55: 04z </created>

<Version> 01.0000 </version>

</Documentproperties>

<Worksheet name = "Page 1st">

<Table>

<Row Index = "2">

<Cell index = "1">

<Data type = "string"> a1001 </data>

</Cell>

<Cell index = "2">

<Data type = "string"> product 1 </data>

</Cell>

<Cell index = "3">

<Data type = "Number"> 120 </data>

</Cell>

<Cell index = "4">

<Data type = "Number"> 98 </data>

</Cell>

</Row>

<Row Index = "3">

<Cell index = "1">

<Data type = "string"> a1002 </data>

</Cell>

<Cell index = "2">

<Data type = "string"> product 2 </data>

</Cell>

<Cell index = "3">

<Data type = "Number"> 435 </data>

</Cell>

<Cell index = "4">

<Data type = "Number"> 998 </data>

</Cell>

</Row>

<Row Index = "4">

<Cell index = "1">

<Data type = "string"> a1003 </data>

</Cell>

<Cell index = "2">

<Data type = "string"> product 3 </data>

</Cell>

<Cell index = "3">

<Data type = "Number"> 42 </data>

</Cell>

<Cell index = "4">

<Data type = "Number"> 1998 </data>

</Cell>

</Row>

<Row Index = "5">

<Cell index = "1">

<Data type = "string"> a1004 </data>

</Cell>

<Cell index = "2">

<Data type = "string"> product 4 </data>

</Cell>

<Cell index = "3">

<Data type = "Number"> 35 </data>

</Cell>

<Cell index = "4">

<Data type = "Number"> 9998 </data>

</Cell>

</Row>

</Table>

</Worksheet>

</Workbook>

You can use the following code to add data to javascript:

 

 

VaR request = new activexobject ('Microsoft. xmlhttp ');

Request. Open ("get", "data. xml", false );

Request. Send ();

Cell. readfromxml (request. responsetext );

In this way, you only need to generate an XML file in a specific format on the server side, and read its content dynamically in the front to complete data filling easily.

 

However, there is still a big problem here. The official XML only mentions two types of data: string and number, but not other types and report style definitions, the XML Data Reading method can only adapt to extremely simple reports. In case of a slightly complicated situation, there is nothing to do with it. It still has to rely on script encoding.

 

Reference:

  • The cell plug-in uses XML to upload table data to the server for B/S operations
  • Helpless support for XML data import for table cells in China

 

 

 

 

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.