openxml

Using OpenXML, how can I associate a list for data validation

≯℡__Kan透↙ 提交于 2019-12-11 08:34:16
问题 I am processing an .xlsm file and need to know how to use a list on another sheet for data validation using openXML and C#. To start, I have a .xlsm file with two empty sheets and macros in it. In my program I open the file, Create the column header on Sheet1 then create the validation list on sheet2. So, after I run my program Sheet1 "A1" contains the text "Color" and Sheet2 "A1:A4" contains "Blue","Green","Red","Yellow". I get this far just fine. I would like to make it so there is a

Problems retrieving content controls with Open XML sdk

被刻印的时光 ゝ 提交于 2019-12-11 08:08:20
问题 I am developing a solution that will generate word-documents. The word-documents are generated on the basis of a template document which has defined content controls. Everything was working good for me when I had only one content control in my template, but after expanding the template document with more content controls, I am getting exceptions. It seems like I am not finding the content controls. This is my method: private void CreateReport(File file) { var byteArray = file.OpenBinary();

Export bitmap image from Excel cells

一世执手 提交于 2019-12-11 08:00:04
问题 I have created an .xlsx file using the OpenXML framework and I am embedding it into a PowerPoint slide (also created using OpenXML) the problem is that I need a placeholder image for the OleObject the Excel sits in on the PowerPoint slide - i can use a standard placeholder, but this looks bad. So I was hoping (most likely using Interop) to find a way of opening the .xlsx file and exporting the relevant cells as a bitmap (.jpg or .png ideally) which I can then feed into my OleObject as the

Replacing bookmarks in docx file using OpenXml SDK and C++/CLI

孤街浪徒 提交于 2019-12-11 07:58:44
问题 I am trying to replace bookmark in docx with text in c++\cli using open xml SDK concept. The below piece of code will fetch bookmarks from word document and checks whether the bookmark matches the string “VERSION” if it is true, it is replaced with the string “0000” in the docx file. Paragraph ^paragraph = gcnew Paragraph(); Run ^run = gcnew Run(); DocumentFormat::OpenXml::Wordprocessing::Text^ text = gcnew DocumentFormat::OpenXml::Wordprocessing::Text(“0000”); run->AppendChild(text);

OpenXML SpreadsheetML Sideways text

你离开我真会死。 提交于 2019-12-11 07:28:37
问题 I'm trying to figure out how to get text to print sideways in a spreadsheet cell in OpenXML. I'm thinking it can be done somehow with the ExtendedProperties of the Cell class. here's what I've got. Cell cell = GetCell(worksheetPart.Worksheet, columnName, rowIndex); cell.DataType = CellValues.InlineString; cell.InlineString = new InlineString() { Text = new Text(textToInsert) }; //fictitious method cell.ExtendedAttributes.SpinSideways(); worksheetPart.Worksheet.Save() 回答1: Styles for cells are

Unable to read Shapes from DOCX file using OpenxmlSDK

我只是一个虾纸丫 提交于 2019-12-11 07:28:17
问题 I have a requirement where in I have to parse a DOCX file and extract all the text and images. I am using OpenxmlSDK 2.5 to achieve this. I am able to parse the images and text but the DOCX also have a group of Shapes which I trying to parse and convert them to Drawing images, which is giving me wrong results. Here is the Sample docx file which I am trying to parse. I referred the this Stack overflow discussion and tried the same way but no luck. The resulting DOCX which I am creating with

XSLT or library to convert Open XML to RTF in .net?

心不动则不痛 提交于 2019-12-11 07:25:09
问题 How can I convert Open XML to RTF in c#? I could use just an xslt to convert, just wandering if there is one already available or if there is a .net library that can do this. 回答1: Not sure if you are aware but there is an XSLT to convert Word Open Xml to Html called DocX2Html_IE.xslt https://openxmlviewer.svn.codeplex.com/svn/Source/OpenXMLViewer/DocX2Html_IE.xslt Which is part of the OpenXML Document Viewer on codeplex. I've used this style sheet as a guide to creating my own Word to Html

Useful use cases for escape character format _xHHHH_ in Office Open XML?

时光怂恿深爱的人放手 提交于 2019-12-11 06:59:47
问题 The default encoding in Office Open XML is UTF-8 . So Unicode is already possible. Nevertheless does Microsoft defining: ECMA-376 Part 1 22.4 Variant Types 22.4.2.4 bstr (Basic String): 22.4.2.4 bstr (Basic String) This element defines a binary basic string variant type, which can store any valid Unicode character. Unicode characters that cannot be directly represented in XML as defined by the XML 1.0 specification, shall be escaped using the Unicode numerical character representation escape

Programmatically change/add thumbnail of pptx powerpoint. With Openxml sdk?

折月煮酒 提交于 2019-12-11 06:18:19
问题 I use openxml sdk 2.5 in combination with the power tools by Eric White. I've managed to create dynamic pptx presentations using template files. (In C#) Unfortunately the thumbnail gets lost during the process. Is there any way to (re)create the thumbnail of a pptx-file using openxml or power tools? I successfully wrote some code that changes an existing thumbnail with an image. But when there is is no thumbnail it gives me a System.NullReferenceException . Here is the code: using

How to highlight text in a sentence using OpenXML?

断了今生、忘了曾经 提交于 2019-12-11 06:12:01
问题 I am using below code to search and highlight text in a MS Word document, it works fine for point 1 but not point 2: 1. John Alter I search for Alter or John , it highlights John / Alter - works. 2. I am going to school I search for going , it highlights going but it changes its order as I am to school going - does not work. How to fix point 2? Below is my code. private void HighLightText(Paragraph paragraph, string text) { string textOfRun = string.Empty; var runCollection = paragraph