Hello,
I created this spreadsheet which is quite simple but when I open it, a part of my calcChain and the formula is deleted. The two first line were in a template, I only added the C3 cell. On the other hand I did the same thing manually, excel opens it and when I open it with the SDK productivity tool it seems the same as the generated one to me.
Can anyone help me out with this, or tell me what's wrong in this file ? I will post the manually modified file if necessary.
Thanks
You have given the main namespace an "x" prefix and it should have none. In other words, this:
xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
should be:
xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
Thank you, I noticed that namespace but i didn't think it mattered. How can i get rid of it ? I don't set any namespace or whatever.
Here is how I create a new spreadsheet:
new XDocument( new XElement(S.worksheet, new XAttribute("xmlns", S.s), new XAttribute(XNamespace.Xmlns + "r", R.r), new XElement(S.sheetData)))
Thank you for the example, but actually I don't create the document, I copy it from a template.
Anyway when I create my spreadsheet from scratch, I use
SpreadsheetDocument.Create(path, SpreadsheetDocumentType.Workbook);
why do you use Linq ?
I use Linq because I find it results in more compact and understandable code. There are also a number of complicated operations that can be done quite simply using Linq. You can use the OpenXML SDK 2.0 functionality instead, if you prefer.
It looks like the Open XML SDK 2.0 uses the "x" prefix. Excel 2007 accepts the "x" prefix as well, at least in some cases. So I was wrong about that. Unfortunately, your formulas require an add-in for Excel that I do not have, so I cannot test your spreadsheet. I do suggest that you try removing the calculation chain from the spreadsheet. That should help isolate the problem more.
I removed the calclulationchainPart but still it won't open. Even if you dond't have the add-in (i don't have it on the computer i'm programming with) the spreadsheet should open, and the cells show an error (like on the first row). Here if you repair the file when excel asks it, the formula is deleted and nothing is left except the text "#NAME?" in the cell (on the second row). Any ideas ?
I found it. It is much simpler than I thought. Sorry about all the wrong turns here. The problem is simply that you used a semicolon instead of a comma to separate the arguments in your function. Change the semicolon between "B2" and "C$1" to a comma and I think it should work for you.
Yes, you were right, the comma was the right thing ! I don't know how it is changed to a semicolon when i open it in excel but it works.
Thanks a lot.