openxml

how to get page numbers based on openxmlelement

南笙酒味 提交于 2019-12-11 06:05:39
问题 For a Paragraph object, how can I determine on which page this is located using the Open XML SDK 2.5 ? I've obtained all child elements in my document and fetched innertext also, using this. foreach (var i in mainPart.Document.ChildElements.FirstOrDefault().ChildElements) { ParagraphElements.Add(i); //openxmlelement list } I want to get page number for corresponding paragraph. for example, I have "this is heading 1" marked as style Heading 1 and this will be updated in TOC. so there I need to

Create openxml document dynamically

孤街醉人 提交于 2019-12-11 05:46:45
问题 I am trying to build a openxml document dynamically, basically I have some classes responsible for creating the sections of my document (tables,paragraph...) then I need to have another class that builds my document, in my case I called it doc, and my other classes are docTable,docRun ... So at the moment I have this: DocRun projectNameTitle = new DocRun(); Run projectNameTxt = disclaimerDescription.createParagraph(document.projectName, SUBTITLECOLOR, FONTSIZESUBTITLE,FONTTYPE); DocRun

How to refresh Pivot Cache of Excel 2010 using Open XML

夙愿已清 提交于 2019-12-11 05:38:35
问题 I am making an Excel Tool using Open XML for some data processing. In this I need to refresh my pivot tables programmatically after inserting the data by refreshing the pivot Cache . I can do this by Microsoft.Office.Interop.Excel assembly but it takes time in opening large files so I want to do this by using Open XML. Do you have any idea that How can I do this using Open XML? Please reply soon. Thank you 回答1: using SDK see the answers here: Excel "Refresh All" with OpenXML when directly

Why am I not able to open open XML (generated in Ruby on Rails) using Excel software?

二次信任 提交于 2019-12-11 05:24:41
问题 I used an xlsx.erb template in my Rails application to generate an Excel report (as office XML). The excel file generates fine but I get an error while opening it in Excel software ( extension or file format maybe be invalid ) This is the template I used to generate the open xml excel: <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas

Edit Word bookmark changes the font

核能气质少年 提交于 2019-12-11 04:59:21
问题 I have a C# program that generates documents using OpenXml. It replaces bookmarks with values using the following method : private void FillBookmark(BookmarkStart bookmark, string value) { var text = new Text(value); bookmark.RemoveAllChildren(); IEnumerable<OpenXmlElement> elementsAfter = bookmark.ElementsAfter(); IEnumerable<OpenXmlElement> insideBookmark = elementsAfter.TakeWhile(element => !(element is BookmarkEnd)); foreach (OpenXmlElement element in insideBookmark) { element

How to add hyperlink to Excel simple shape using apache poi?

梦想与她 提交于 2019-12-11 04:29:41
问题 I use Microsoft Excel 2007. I have a simple shape on the first excel sheet. I would like to add a hyperlink on this simple shape which refer to another sheet on the specific row and column. I make a research about this but I only found examples which demonstrate how to add a hyperlink to a given cell. How can I add a hyperlink to a given simple shape with the help of Apache POI? 回答1: I found solution of my issue. I hope it will help to someone else. // Example for hyperlink address // String

Out Of Memory Exception - Using SqlDataReader and OpenXML

[亡魂溺海] 提交于 2019-12-11 03:48:02
问题 Edit: Due to memory issues, I am attempting to now use: http://blogs.msdn.com/b/brian_jones/archive/2010/06/22/writing-large-excel-files-with-the-open-xml-sdk.aspx But still running into some problems. String strWham = strExtract + strExtract2012; System.Data.SqlClient.SqlCommand objCmd = new System.Data.SqlClient.SqlCommand(strWham, objConn); objCmd.CommandTimeout = 3000; System.Data.SqlClient.SqlDataReader objReader; objReader = objCmd.ExecuteReader(); string path = @"\\wsi\userdata

How to Read .Doc Template File and Edit Template with Values?

梦想的初衷 提交于 2019-12-11 03:44:42
问题 I have a document template and I want to use that template for merging client information with that (Replacing <>, <> <> with our information from database. To do this i first need to read the document, update the fields and then save it with tag replaced data. Can any one please help me to visualize this; how to do this and using what tools? Thanks, Jigar 回答1: I found my answer from http://docx.codeplex.com/ tool. It is really super cool tool to do modification in your document template.

Export the content of content control into another word document

冷暖自知 提交于 2019-12-11 03:39:03
问题 I have a word document with many content controls. How can I export the content of content control into another word document? I'm using C# and open xml sdk. Regards. 回答1: Here are two great articles that will show you how to do this: Using LINQ to XML to Retrieve Content Controls in Word 2007 Using Nested Content Controls for Data and Content Extraction from Open XML WordprocessingML Documents 回答2: content controls are not bound to CustomXMLParts. I'm using Altchunck to merge multiple docx

Word Open XML Mail Merge

…衆ロ難τιáo~ 提交于 2019-12-11 03:28:00
问题 I'm attempting to manually create a mail merge using Word's XML (from Word 2007). I have the following XML which isn't working: <w:mailMerge> <w:mainDocumentType w:val="catalog" /> <w:linkToQuery /> <w:dataType w:val="native" /> <w:connectString w:val="Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=TheServer;Data Source=." /> <w:query w:val="SELECT * FROM `Table` WHERE `id_field` = 7" /> <w:dataSource r:id="rId1" /> <w:activeRecord w:val="0" /> </w:mailMerge> I can't really