openxml

Parsing OpenXML with multiple elements of the same name

与世无争的帅哥 提交于 2019-12-18 06:48:57
问题 I have a data structure as such: <rootnode> <group> <id>1</id> <anothernode>first string</anothernode> <anothernode>second string</anothernode> </group> <group> <id>2</id> <anothernode>third string</anothernode> <anothernode>fourth string</anothernode> </group> </rootnode> And the following code: EXEC sp_xml_preparedocument @index OUTPUT, @XMLdoc SELECT * FROM OPENXML (@index, 'rootnode/group') WITH ( id int 'id', anothernode varchar(30) 'anothernode' ) which gives me the result id |

Create Merge Cells using OpenXML

百般思念 提交于 2019-12-18 05:41:47
问题 Please consider this Excel: and it's XML: I want to create such this Excel that has multiple merged cells using OpenXML. How I can do this? thanks 回答1: You can use the MergeCells and MergeCell classes to create the merged cells you require. The MergeCells class is the collection of merge cells ( <mergeCells count="3"> in your XML) and the MergeCell class represents each individual set of merged cells ( <mergeCell ref="xx:xx" /> in your XML). To populate data in the merged cells you need to

Cannot insert the OpenXmlElement “newChild” because it is part of a tree

≯℡__Kan透↙ 提交于 2019-12-18 04:40:34
问题 The Title states the error I am getting. I'm trying to hide all the text in a word doc using OpenXml. Currently when I try and append the Paragraph properties I receive the above error. I can't find much about this error online. Code that returns error using (WordprocessingDocument wdDoc = WordprocessingDocument.Open(mDoc_copy, true)) { // Manage namespaces to perform XPath queries. NameTable nt = new NameTable(); XmlNamespaceManager nsManager = new XmlNamespaceManager(nt); nsManager

How to generate Table Of Contents using OpenXML SDK 2.0?

半腔热情 提交于 2019-12-18 04:03:18
问题 Using the SDK I'm building Word documents that contain reports. These documents need to have TOC. Does anybody have a complete solution that I can follow in order to understand how to do this? (I've read everything on http://openxmldeveloper.org/) 回答1: Have a look at Fourth and Final Screen-Cast in Series on Adding/Updating the TOC in OpenXML WordprocessingML Documents by Eric White. Hope that helps! UPDATE: According FAQ from MSDN Forums I see that this feature is not supported: 8) How to

Create page break using OpenXml

大兔子大兔子 提交于 2019-12-18 03:52:06
问题 I use OpenXml to create Word document with simple text and some tables under this text. How can I force Paragraph with this text to show always on new page? Maybe this paragraph should be some Header but I'm not sure how to do this. Thanks 回答1: You can create a page break within a Run element using the <w:br> element. In raw OpenXML, it would look something like: <w:p> <w:r> <w:br w:type="page" /> </w:r> </w:p> If you're using the OpenXml SDK, you can use new Paragraph( new Run( new Break(){

create word document with Open XML

自闭症网瘾萝莉.ら 提交于 2019-12-18 03:38:17
问题 I am creating a sample handler to generate simple Word document. This document will contains the text Hello world This is the code I use (C# .NET 3.5), I got the Word document created but there is no text in it, the size is 0. How can I fix it? (I use CopyStream method because CopyTo is available in .NET 4.0 and above only.) public class HandlerCreateDocx : IHttpHandler { public void ProcessRequest(HttpContext context) { using (MemoryStream mem = new MemoryStream()) { // Create Document using

How to convert docx to html file using open xml with formatting

无人久伴 提交于 2019-12-18 02:57:11
问题 I know there are lot of question having same title but I am currently having some issue for them I didn't get the correct way to go. I am using Open xml sdk 2.5 along with Power tool to convert .docx file to .html file which uses HtmlConverter class for conversion. I am successfully able to convert the docx file into the Html file but the problem is, html file doesn't retain the original formatting of the document file. eg. Font-size,color,underline,bold etc doesn't reflect into the html file

How to split table to new PowerPoint slide when content flows off current slide using Open XML SDK 2.0

杀马特。学长 韩版系。学妹 提交于 2019-12-17 18:59:53
问题 I have a bunch of data that I need to export from a website to a PowerPoint presentation and have been using Open XML SDK 2.0 to perform this task. I have a PowerPoint presentation that I am putting through Open XML SDK 2.0 Productivity Tool to generate the template code that I can use to recreate the export. On one of those slides I have a table and the requirement is to add data to that table and break that table across multiple slides if the table exceeds the bottom of the slide. The

How to retrieve Tab names from excel sheet using OpenXML

我的未来我决定 提交于 2019-12-17 18:22:26
问题 I have a spreadsheet document that has 182 columns in it. I need to place the spreadsheet data into a data table, tab by tab, but i need to find out as I'm adding data from each tab, what is the tab name, and add the tab name to a column in the data table. This is how I set up the data table. I then loop in the workbook and drill down to the sheetData object and walk through each row and column, getting cell data. DataTable dt = new DataTable(); for (int i = 0; i <= col.GetUpperBound(0); i++)

Duplicating Word document using OpenXml and C#

你离开我真会死。 提交于 2019-12-17 16:28:30
问题 I am using Word and OpenXml to provide mail merge functionality in a C# ASP.NET web application: 1) A document is uploaded with a number of pre-defined strings for substitution. 2) Using the OpenXML SDK 2.0 I open the Word document, get the mainDocumentPart as a string and perform the substitution using Regex. 3) I then create a new document using OpenXML, add a new mainDocumentPart and insert the string resulting from the substitution into this mainDocumentPart. However, all formatting