openxml

Change font color in OpenXML word document (C#)

三世轮回 提交于 2019-12-09 10:56:42
问题 I've been searching for hours and I just can't seem to find a solid answer for this. I have an existing document with content controls that I need to edit the text in with external data. If the data for one of the controls is not present, then I need to replace the text with an appropriate notice and change the font color. I have the text entry and all that working just fine, the only part that won't seem to do its job is changing the font color. The current code I have doesn't give me any

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

Get a CheckBox in Word using OpenXML

大城市里の小女人 提交于 2019-12-08 23:29:15
问题 How does one get a handle to a CheckBox control that's embedded in a Word document using OpenXML? You would think that either Paragraph.ControlPropertiesPart or Paragraph.Descendents() would achieve something but in every single case I get a null type returned. I can traverse down the document tree using the actual XML structure, but this seems cumbersome. Suggestions welcome. 回答1: The code below shows how to enumerate all checkboxes in a word document by using the Decendants<CheckBox>()

Using C# & Powerpoint OpenXML, is it possible to change the font size and color of text

我的梦境 提交于 2019-12-08 16:38:03
问题 I am using openXML and C# to generate a powerpoint slide but I can't seem to figure out how to change / set the text size and color. Is this possible and are there any example as I can't seem to find any with googling? I am building out a table (similar to this: http://blogs.msdn.com/b/brian_jones/archive/2009/08/13/adding-repeating-data-to-powerpoint.aspx) and I want to change a number of things in each cell (fontsize, font color, backcolor of cell). 回答1: Your comments state this Formatting

Can I use the Open XML SDK in Mono?

假装没事ソ 提交于 2019-12-08 15:46:35
问题 Can the Open XML SDK be used in Mono? 回答1: Edit: It seems to be working in the meantime: https://stackoverflow.com/a/28322467/743897 Today (somewhere in 2011) I played around with the SDK and Mono 2.6. First I checked what MoMA thinks of the dll: 4 different Methods in DocumentFormat.OpenXml.dll need the following method from Mono which is not available. At least according to MoMA. void XmlReaderSettings.set_MaxCharactersInDocument (Int64) But I was brave and tried to do stuff. The bad thing:

Editing custom XML part in word document sometimes corrupts document

对着背影说爱祢 提交于 2019-12-08 11:58:33
问题 We have a system that stores some custom templating data in a Word document. Sometimes, updating this data causes Word to complain that the document is corrupted. When that happens, if I unzip the docx file and compare the contents to the previous version, the only difference appears to be the expected change in the customXML\item.xml file. If I re-zip the contents using 7zip, it seems to work OK (Word no longer complains that the document is corrupt). The (simplified) code: void

How do I read data from a word with format using the OpenXML Format SDK with c#?

馋奶兔 提交于 2019-12-08 09:56:48
问题 I used below lines of code for getting string from docx file. I can able to read string but not in format. how to read docx data with format. using (WordprocessingDocument myDocument = WordprocessingDocument.Open(docxFilePath, true)) { Body body = myDocument.MainDocumentPart.Document.Body; string content = body.InnerText; } Thanks for quick reply. 回答1: OpenXML format - is an XML based format that provides the access to entire content of Office documents like MS Word, Excel, PowerPoint, etc.

Ignore spelling error in DocX file

拟墨画扇 提交于 2019-12-08 09:06:36
问题 Using OpenXML, I'm inserting some text into a document that I know will be marked as incorrectly spelled (because it's a product name) and will be marked with the angry red line/squiggly when the file is opened in Word. How can I mark the XML so that it knows that the spelling is correct for that word? I've tried messing around with ProofError, putting it in various places with relation to my paragraph and my run and with different values for type, but can't figure out if there's a way to use

How to use OPENXML to load XML data into existing SQL Table?

家住魔仙堡 提交于 2019-12-08 08:30:43
问题 I am a newbie to OPENXML. But I am trying to load a .XML file into a SQL table that I created for this. I do not receive any errors with this code, but it doesn't insert any records either. This is the table I created in 2008 SQL Server: CREATE TABLE HOMEROOM( HOMEROOM_TEACHER INT, HOMEROOM_NUMBER INT, ENTITY_ID INT) And this is the T-SQL code I am trying to execute: DECLARE @idoc int DECLARE @xmlDocument varchar(MAX) DECLARE @Status INT SET @xmlDocument =' <xml xmlns:s="uuid:BDC6E3F0-6DA3

Search of an input string in spreadsheet

﹥>﹥吖頭↗ 提交于 2019-12-08 07:46:57
问题 I am using the Open XML SDK to open an Excel file (xlsx) and I want to find a specific string or integer passed from outside to check for duplicates of the value in the spreadsheet. How can I search for the input string in all the cells of spreadsheet? 回答1: Here: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Spreadsheet; namespace