spreadsheetml

Excel not inserting leading zero

蹲街弑〆低调 提交于 2020-01-24 12:36:05
问题 I am using Office OpenXml to write to an Excel file. The file is a template so it already has all my headers and formatting for my columns. I am inserting numbers that have leading zeroes to a "special" column which is basically a 10 digit number. However in my code I can see that it is setting the value to for example 0000000004 . The result in the sheet with a value of 4 in that cell and the actual cell showing 0000000004 . Here is my code to write to the cell. if (reader[2].ToString()

Add Excel's SUM() to XLST result page?

☆樱花仙子☆ 提交于 2019-12-24 03:19:15
问题 How to apply SUM() function to every hours node? I will be saving this transfomred XML as Excel where I would like it to have SUM() function embedded. After researching there seems to be so many ways to do it, but none really apply to my problem. XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <img src="../images/company_logo.png"></img> <p>Company: <xsl:value-of select=

XLSX- how to get rid of the default namespace prefix x:?

我是研究僧i 提交于 2019-12-22 04:39:15
问题 I'm generating XLSX spreadsheet using OOXML SDK, and I need to get rid of x: namespace prefix. How can I achieve this? using (SpreadsheetDocument doc = SpreadsheetDocument.Open("template.xlsx", true)) { //Save the shared string table part if (doc.WorkbookPart.GetPartsOfType().Count() > 0) { SharedStringTablePart shareStringPart = doc.WorkbookPart.GetPartsOfType().First(); shareStringPart.SharedStringTable.Save(); } //Save the workbook doc.WorkbookPart.Workbook.Save(); } Here, the original

How do I read data from a spreadsheet using the OpenXML Format SDK?

吃可爱长大的小学妹 提交于 2019-12-17 10:44:07
问题 I need to read data from a single worksheet in an Excel 2007 workbook using the Open XML SDK 2.0. I have spent a lot of time searching for basic guidelines to doing this, but I have only found help on creating spreadsheets. How do I iterate rows in a worksheet and then iterate the cells in each row, using this SDK? 回答1: The way I do this is with Linq. There are lots of sample around on this subject from using the SDK to just going with pure Open XML (no SDK). Take a look at: Office Open XML

Inconsistent visualization of numerical values in Excel 2007 vs the underlying xml file

一个人想着一个人 提交于 2019-12-12 23:12:15
问题 I am attempting to read an Excel 2007 file (xlsx) from outside of Excel and I am finding an inconsistency that I cannot explain. If you enter the value of 19.99 into a cell and then look at the underlying Xml document it is actually stored as 19.989999999999998. This is not the only value that does this, but it is a reasonable example. No formatting is applied in the sheet. In my example I just open a new Workbook, type in 19.99 in A1 and save the file. I have attempted to open this simple

OpenXML SpreadsheetML Sideways text

你离开我真会死。 提交于 2019-12-11 07:28:37
问题 I'm trying to figure out how to get text to print sideways in a spreadsheet cell in OpenXML. I'm thinking it can be done somehow with the ExtendedProperties of the Cell class. here's what I've got. Cell cell = GetCell(worksheetPart.Worksheet, columnName, rowIndex); cell.DataType = CellValues.InlineString; cell.InlineString = new InlineString() { Text = new Text(textToInsert) }; //fictitious method cell.ExtendedAttributes.SpinSideways(); worksheetPart.Worksheet.Save() 回答1: Styles for cells are

Style for wrapped text with spreadsheetml

瘦欲@ 提交于 2019-12-10 14:26:27
问题 I generate my spreadsheet with xslt and want a cell with wrapped text (or better: a text with a line break in it). So my xslt generates the following XML for the sheetdata: <sheetData> <row r="1"> <c r="A1" t="inlineStr"> <is> <t> a simple string line break jeeeehaaa </t> </is> </c> </row> </sheetData> After I'm finished building my Workbook, I open it in Excel; and there's no line break, just a simple one-line string in A1. has anyone a solution to this? Doesn't have to be in xml or xslt

OpenXML SDK Spreadsheet starter kits

大憨熊 提交于 2019-12-09 05:20:14
问题 I am trying to start working with Excel documents through the OpenXML SDK Spreadsheet API. But I haven't found any good guides or even examples on how to create a xlsx file from scratch. Only how to open an existing document and modify it. I have been thinking on having a empty template document and make a copy of it an then begin my proccessing on it. But it doesent feel right. It might be easier but I not comfortable using a technique I dont feel that I understand "pretty" good at least. So

How change excel 2007 document orientation to landscape by OpenXML sdk

淺唱寂寞╮ 提交于 2019-12-08 00:13:35
问题 I need help with changing excel 2007 document orientation to landscape. I have not found any helpful information about this. I am using OpenXML SDK for this. The only thing I have found: when I create a new Worksheet I should set PageSetup() { Orientation = OrientationValue.Landscape}; But this doesn't help. Can anybody help with this problem? Thank you. 回答1: You're on the right track with the OrientationValue.Landscape. You just need to loop through all worksheets and set the orientation

How change excel 2007 document orientation to landscape by OpenXML sdk

岁酱吖の 提交于 2019-12-06 11:22:48
I need help with changing excel 2007 document orientation to landscape. I have not found any helpful information about this. I am using OpenXML SDK for this. The only thing I have found: when I create a new Worksheet I should set PageSetup() { Orientation = OrientationValue.Landscape}; But this doesn't help. Can anybody help with this problem? Thank you. You're on the right track with the OrientationValue.Landscape. You just need to loop through all worksheets and set the orientation attribute on the PageSetup element in order to set all worksheets to landscape: public static void SetLandscape