openxml

create a new document from word template with multiple pages using documentformat.openxml

橙三吉。 提交于 2019-12-25 17:45:05
问题 I have a Microsoft Word template with some content controls. It contains a table of contents and some extra information. On the page, I have set some content controls where I would like to inject a new text from a RESTful service. If the RESTful service returns an array of data (objects), I need to replicate the information on each page based on the Word template. Any idea on how can I do that using the Open XML SDK ( DocumentFormat.OpenXml )? Edit: I found this post here, which is great, but

How to make the first page in a section have different margins?

戏子无情 提交于 2019-12-25 08:11:25
问题 I'm using PHP to create Word documents. I've figured out how to set the page margins for a section. I've also figured out how to set headers and footers for the first page, even pages and default pages of a section. What I can't figure out is how to set the top margin of a page different for the first page in a section. Essentially, I have a larger header image on the first page of the section and need to push the top margin of that page down twice as far as the top margins on all the other

How to make a powerpoint chart reflect changes to its data source?

允我心安 提交于 2019-12-25 06:24:28
问题 I'm using openxml sdk 2 to change the excel data from a chart on a powerpoint file (2007). I can change the data but when I open the changed file on powerpoint, the chart shows the original data. Only when I choose "Edit data", it shows the excel sheet with the correct data and the chart is updated. How can I make the chart reflect the underlying changes? 回答1: It sounds as though you have an embedded chart rather than a linked one. With an embedded chart, the chart and the spreadsheet behind

How to build custom sentences with OpenXML

醉酒当歌 提交于 2019-12-25 05:16:16
问题 I would like to know if there is a way to "play" with sentences in a .docx. Here's what I need to do: I have a paragraph in a document exemple of my paragraph: This is a paragraph that I need to format based on some conditions and I can't figure how to do this with openxml sdk. end of exemple. So based on a condition that I evaluate in c# I would like to add/remove the text. Another thing that you should know id that I would like the product owner to change the text of the document. Basicly

Open XML SDK adding gradient border to all drawings

ε祈祈猫儿з 提交于 2019-12-25 04:14:12
问题 I'm working on my own project, and i want to apply gradient borders to all pictures in the ms word file . On my research, i was only able to insert new pictures with assigned parameters. The problem is, that i can't figure it out how to access and customize existing picture elements . I thought, that if i create new elements, and then simply append them to a file it will do the work, but somehow Drawing element drops an error because it belongs to a tree or smth. Below is the code fragment of

XML cells incorrectly being shown as SharedStrings when they are not

有些话、适合烂在心里 提交于 2019-12-25 03:54:14
问题 I am parsing through an Excel spreadsheet and had some problems with some values, so on the suggestions of a stackoverflow member, I evaluated them as shared strings. Now, however, some of the cell values are not shared strings and my conditional still evaluates as true, meaning they are SharedStrings. So I am wondering if my code for evaluating these is correct or maybe there's something wrong with the Excel spreadsheets I've been working with. Here is an example conditional, which in this

XML cells incorrectly being shown as SharedStrings when they are not

若如初见. 提交于 2019-12-25 03:54:05
问题 I am parsing through an Excel spreadsheet and had some problems with some values, so on the suggestions of a stackoverflow member, I evaluated them as shared strings. Now, however, some of the cell values are not shared strings and my conditional still evaluates as true, meaning they are SharedStrings. So I am wondering if my code for evaluating these is correct or maybe there's something wrong with the Excel spreadsheets I've been working with. Here is an example conditional, which in this

Search And Replace Text in OPENXML (Added file)

假如想象 提交于 2019-12-25 03:34:38
问题 I know there is alot of posts on it, BUT nothing worked for my problem: Im using OPENxml to create word document, and I am adding some ready files to the document during the creation. I want to change some text in the file that I am adding after the document is ready. So thats what I tried: First creating the document: fileName = HttpContext.Current.Server.MapPath("~/reports/"+fileName+".docx"); using (var doc = WordprocessingDocument.Create( fileName, WordprocessingDocumentType.Document)) {

Creating Pivot Table in Excel using Open XML and C#

半腔热情 提交于 2019-12-25 02:55:51
问题 I used store a data into the DataTable and wants to create a Pivot Table using this data. I have gone through many posts and also read the Microsoft's documentation on creating Pivot table through Open XML but couldn't get the solution. Can anyone please post some code to create Pivot table. Thanks in advance. 回答1: Install the Open XML SDK, it contains a tool called Open XML SDK Productivity Tool. How to use it: Open Excel and create a file containing a Pivot table. Save it and open it with

Xlsx styles getting wrong fill pattern

给你一囗甜甜゛ 提交于 2019-12-25 02:42:56
问题 I am writing an xlsx file where I want to apply my own styles to cells in a worksheet. I have a case where style 1 and style 2 both specify solid red, but when I open it in excel the first is gray stippled but the second is what I expect. I am stumped.. Here are some bits of xml from the attached file. In the worksheet, I have 2 cells: <x:c t="inlineStr" s="2"> <x:is> <x:t>looks right</x:t> </x:is> </x:c> <x:c t="inlineStr" s="1"> <x:is> <x:t>looks wrong</x:t> </x:is> </x:c> In the styles.xml