openxml-sdk

TextBox positioning in OpenXML

早过忘川 提交于 2019-12-02 14:51:23
问题 I am new in OpenXML. I am trying to create the word(.docx) file having simple text and images in it using openxml. I have already mentioned all this in my earlier post: My Earlier post I am using this code WordprocessingDocument doc = WordprocessingDocument.Create("E:\\test11.docx", DocumentFormat.OpenXml.WordprocessingDocumentType.Document); { MainDocumentPart mainPart = doc.AddMainDocumentPart(); mainPart.Document = new Document(); Body body = mainPart.Document.AppendChild(new Body());

openXmlSdk insert new line inside of a Run Element

爷,独闯天下 提交于 2019-12-02 12:26:50
I have text inside of the Run Element. I'm trying to replace the \r in the string with a line break . The text as follows This is an example project for testing purposes. \rThis is all sample data, none of this is real information. \r\rThis field allows for the entry of more information, a larger text field for example purposes and the innerXml of the Run Element is translated into <w:rPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> <w:rFonts w:cstheme="minorHAnsi" /> </w:rPr> <w:t xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> This is an

Does a good wrapper class and/or library for open xml Excel editing exist?

冷暖自知 提交于 2019-12-02 11:53:29
问题 I'm looking for a nice library for editing and/or generating Excel documents on our Windows server. I feel that the open xml sdk is probably the way to go, but to me the learning curve seems steep and our dev time is limited. I think that it just shouldn't be that difficult to edit an Excel document. I'm ready to reinvent the wheel, but thought it would be worthwhile to ask first whether there is a good project/library out there that wraps open xml and makes interacting with Excel easier. In

TextBox positioning in OpenXML

筅森魡賤 提交于 2019-12-02 08:42:04
I am new in OpenXML. I am trying to create the word(.docx) file having simple text and images in it using openxml. I have already mentioned all this in my earlier post: My Earlier post I am using this code WordprocessingDocument doc = WordprocessingDocument.Create("E:\\test11.docx", DocumentFormat.OpenXml.WordprocessingDocumentType.Document); { MainDocumentPart mainPart = doc.AddMainDocumentPart(); mainPart.Document = new Document(); Body body = mainPart.Document.AppendChild(new Body()); Paragraph para = body.AppendChild(new Paragraph()); ParagraphProperties oParagraphProperties = para

Having trouble reading excel file with the OpenXML sdk

有些话、适合烂在心里 提交于 2019-12-02 05:58:04
I have a function that reads from an excel file and stores the results in a DataSet . I have another function that writes to an excel file. When I try to read from a regular human-generated excel file, the excel reading function returns a blank DataSet , but when I read from the excel file generated by the writing function, it works perfectly fine. The function then will not work on a regular generated excel file, even when I just copy and paste the contents of the function generated excel file. I finally tracked it down to this, but I have no idea where to go from here. Is there something

Does a good wrapper class and/or library for open xml Excel editing exist?

一曲冷凌霜 提交于 2019-12-02 05:32:24
I'm looking for a nice library for editing and/or generating Excel documents on our Windows server. I feel that the open xml sdk is probably the way to go, but to me the learning curve seems steep and our dev time is limited. I think that it just shouldn't be that difficult to edit an Excel document. I'm ready to reinvent the wheel, but thought it would be worthwhile to ask first whether there is a good project/library out there that wraps open xml and makes interacting with Excel easier. In this official MS tutorial, the code that retrieves the value of a cell is dozens of lines long. http:/

Converting a <V:shape>/Embed to a w:drawing

被刻印的时光 ゝ 提交于 2019-12-02 04:48:05
I have a V:Shape that I am assuming has come from the conversion of a .Doc file to a .Docx file, but in the code I have written, I am wanting a DocumentFormat.OpenXml.Drawing.Pictures.Picture . Is there any way to programically convert to a Picture ? The snippet I'm using is: foreach (var item in value) { if (!item.Descendants<Picture>().Any()) //pictures are processed differently - they're an absolute s**t storm to code... { p.Append(item.CloneNode(true)); } else { p.Append(CreateImageRun(source, item, target, f)); } } public Run CreateImageRun(WordprocessingDocument sourceDoc, Run sourceRun,

How to get list of shapes in SdtBlock element using Open XML SDK?

醉酒当歌 提交于 2019-12-02 04:15:09
问题 How can I get the list of shapes (textboxs) in an SdtBlock element using Open XML SDK? Regards. 回答1: In order to grab all the shapes in a WordProcessingDocument you can use linq to traverse all the descendants of the body: using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(stream, true)) { IEnumerable<DocumentFormat.OpenXml.Vml.Shape> shapes = wordDoc.MainDocumentPart.Document.Body.Descendants<DocumentFormat.OpenXml.Vml.Shape>(); } 来源: https://stackoverflow.com/questions

yyyy-MM-dd date format in Export to Excel

流过昼夜 提交于 2019-12-02 02:27:00
问题 Is there any way for getting date alone from UniversalSortableDateTimePattern using this in Export to Excel function. The Excel doesn't accepts the date format.. I need to display as yyyy-MM-dd. Any suggestions ll be helpful ? My code as dtASalesDrivers.Columns.Add(new System.Data.DataColumn("Start Date", typeof(String))); DateTime dt = Convert.ToDateTime(txtATrendStartDate.Text); drASalesDrivers[2] = string.Format("{0:yyyy-MM-dd}", dt); dtASalesDrivers.Rows.Add(drASalesDrivers); Edit :

yyyy-MM-dd date format in Export to Excel

允我心安 提交于 2019-12-02 01:24:56
Is there any way for getting date alone from UniversalSortableDateTimePattern using this in Export to Excel function. The Excel doesn't accepts the date format.. I need to display as yyyy-MM-dd. Any suggestions ll be helpful ? My code as dtASalesDrivers.Columns.Add(new System.Data.DataColumn("Start Date", typeof(String))); DateTime dt = Convert.ToDateTime(txtATrendStartDate.Text); drASalesDrivers[2] = string.Format("{0:yyyy-MM-dd}", dt); dtASalesDrivers.Rows.Add(drASalesDrivers); Edit : DateTime dt = Convert.ToDateTime(txtATrendStartDate.Text); drASalesDrivers[2] = string.Format("{0:u}", dt);