ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Caption attribute at Cell in Excel XML (https://www.excelbanter.com/excel-discussion-misc-queries/120211-caption-attribute-cell-excel-xml.html)

dob_xml

Caption attribute at Cell in Excel XML
 
Hi,

I use excel files saved in XML format as templates for report generation. I
am using C# & ASP.NET.

The original templates come from users; which I convert to XML and then
place on the server and write the code to populate them.

Generally users populate a cell with a sample value e.g. 6000. I then know
which cell to populate in the XML file with the real value.

So for me to identify the cell to change I might use an XPath expression
like this:
ss:Workbook/ss:Worksheet[@ss:Name='Sheet1']/ss:Table/ss:Row/ss:Cell[ss:Data=6000]

This works well. However with my current template it can take 150-200ms to
find each cell.

I introduced the Caption attribute to the cells I want to populate (an
individual caption for each cell)

<Cell ss:StyleID="s172" ss:Caption="xxx"<Data ss:Type="String"
x:Ticked="1"6426</Data</Cell


Now my XPath expression is like this:
/ss:Workbook/ss:Worksheet[@ss:Name='Sheet1']/ss:Table/ss:Row/ss:Cell[@ss:Caption='xxx']"

This has reduced the time taken to find the node to < 1ms and with a lot of
cells to populate that is what I need.

The problem:

I manually edited at the ss:Cell level to add an ss:Caption attribute to
identify cells on a sheet.


I need a way that users can do this using the Excel application so when I
receive the Excel file it will already contain ss:Caption attributes on the
cells

they want populated.

How can this be done? Is there an alternative cell attribute I could use
that the users would have access to via Excel?

Thanks in advance



All times are GMT +1. The time now is 11:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com