ss:Formula in excel saved in xml format

M

m_karbala

Hi,
I have a have a excel file in XML format. In the first cell I want t
have a exact formula not a reference formula, meaning instead o
formula="=RC[1]+R[1]C[2]" I want it to be formula="=A1+B1". Is ther
anybody how can help me in this case?

Here is the file. You just need to save it as xml and open it with th
excel.
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:eek:ffice:spreadsheet"
xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns:x="urn:schemas-microsoft-com:eek:ffice:excel"
xmlns:ss="urn:schemas-microsoft-com:eek:ffice:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table >
<Row>
<Cell ss:Formula="=RC[1]+R[1]C[2]">
</Cell>
</Row>
</Table>
</Worksheet>
</Workbook
 
B

blueju

I am struggling with the same problem at the moment, Excel doesn't seem
to like A1 style references in XML, you can use R1C1 + R2C1 though i.e.
absolute addressing rather than relative but it only seems to like the
R1C1 style, hope this helps. Please post back if you resolve the A1
style referencing.
 
M

m_karbala

I am creating the this xml file using the c#. I have my formula saved in
onother xml file, and my code use those formula and some other info to
create the xml file. Changing formula to absolute addressing make them
absolute formula like $A$1+$B$2. I dont want this. I want A1+A2.
:confused:
 
C

Chris Allison

Like BlueJu and yourself, I am grapppling with a very similar problem.

One idea is that if you are generating the xml file in c, and you always
want to import to the same starting point, you should be able to work out
where you are in the loop and therefore where the absolute reference should
be.

My problem is that I cant figure out how to actually import a formula, full
stop. When I do I end up with a cell that is formatted as text, not in a
general format that automatically calculates my formulas.
 
M

m_karbala

Hi,

I can think of 2 cases:
1- If you have your formula in the <dataType="string">""your formula""
</Data> element then it will be appear as a string.
2- If you have it as a ss:formula then check your styles. It is
possible that in you style the format of the cell is text. Even thought
it will give you an error and won’t show your formula at all in excel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top