openxml

Set xlsx to recalculate formulae on open

瘦欲@ 提交于 2020-08-22 09:41:15
问题 I am generating xlsx files and would like to not have to compute the values of all formulae during this process. That is, I would like to set <v> to 0 (or omit it) for cells with an <f> , and have Excel fill in the values when it is opened. One suggestion was to have a macro run Calculate on startup, but have been unable to find a complete guide on how to do this with signed macros to avoid prompting the user. A flag you can set somewhere within the xlsx would be far better. Edit: I'm not

Open XML: Word - Getting all Paragraphs marked as “Heading1” style

夙愿已清 提交于 2020-08-21 05:36:46
问题 Using Word I have created a Docx with the standard normal.dot as a test. Hello-world level complexity. I wish to get all the paragraphs which are styled with the " Heading1 " style in Word. I can get all the paragraphs, but don't know how to filter down to Heading1. using (var doc = WordprocessingDocument.Open(documentFileName, false)) { paragraphs = doc.MainDocumentPart.Document.Body .OfType<Paragraph>().ToList(); } 回答1: [Test] public void FindHeadingParagraphs() { var paragraphs = new List

Powershell script to unzip xlsx and read contents from a sheet xml file

痞子三分冷 提交于 2020-08-09 10:50:09
问题 Background I am trying to design a script that I can run on a server without an Excel installation or importing modules/libraries. This rules out COM Excel.Application, the ImportExcel module and other 3rd party libraries. Instead, I unzip the excel file into a collection of xml files. I need to parse these xml files in powershell for a given range of cell values spanning multiple Excel sheets. So far, I have written a script to retrieve the sheetIDs: unzip myExcel.xlsx [xml]$workbookXML =

OpenXML SpreadsheetDocument SaveAs() giving file-in-use error

天涯浪子 提交于 2020-07-23 02:26:12
问题 I'm trying to generate an Excel spreadsheet dynamically, using OpenXMLPowerTools v4.5.3.2, DocumentFormat.OpenXML v2.9.1, called from a ASP.Net Core web app. I've verified that able to generate the spreadsheet OK. The problem is that I need to generate the spreadsheet ... and return it as a MEMORY STREAM (so the ASP.Net Core web controller HCExcelReport.cs: class HCExcelReport { protected SpreadsheetDocument doc; protected MemorySpreadsheet ms; protected string tmpFile = System.IO.Path

Directly convert a single XML file to DOCX

余生颓废 提交于 2020-07-07 06:38:23
问题 I tried to convert a single XML file into a DOCX file, and I did it by transforming my XML into an XHTML by using XSLT, then open the XHTML on MS Word and save it as DOCX. But my task is to convert any XML Structure (DITA, TEI, DocBook, etc.) to DOCX directly ... are there any other way to do it? I just can't find any sources for this. It's always DOCX to XML and not the other way around. 回答1: Yes, you can use XSLT to transform from any of those XML formats to OOXML. XSLT is ideal for XML to

Directly convert a single XML file to DOCX

99封情书 提交于 2020-07-07 06:34:10
问题 I tried to convert a single XML file into a DOCX file, and I did it by transforming my XML into an XHTML by using XSLT, then open the XHTML on MS Word and save it as DOCX. But my task is to convert any XML Structure (DITA, TEI, DocBook, etc.) to DOCX directly ... are there any other way to do it? I just can't find any sources for this. It's always DOCX to XML and not the other way around. 回答1: Yes, you can use XSLT to transform from any of those XML formats to OOXML. XSLT is ideal for XML to

Do we need Office Installation to work with OpenXML?

好久不见. 提交于 2020-07-05 07:05:54
问题 I am working with OpenXML manipulating the document. Do we need to have office installed for opening document through OpenXML? 回答1: No. You only need to have a reference to the library that provides all the OpenXML functionality. That library is not dependant on Office. 来源: https://stackoverflow.com/questions/3015272/do-we-need-office-installation-to-work-with-openxml