openxml

How to Create/Open Excel files using OpenXml with C#

廉价感情. 提交于 2019-12-12 00:40:57
问题 I have a console application in which we are creating xlsx files using OPENXML, we are able to create xlsx file & save it into specific folder in application. But Now we want to show that file as a Save/Open dialog pop up. Then we can able to specify a particular path to save/ to open the existing files. I am new to this OpenXml, Can anyone please help me on this to proceed further? How can I acheive this? Do we have any built-in DLL for this? Thanks. 回答1: se the Save file dialog. It will

Writing Date Value in a cell using Open xml

北慕城南 提交于 2019-12-12 00:32:53
问题 I need to write a date in cell using date type using Open XML. Can you please tell me how can I do this? 回答1: I got the answer and sharing with you all... Just add cell as we do.. Cell cell =new Cell(){ cellReference=A1 }; //Or other necessary details cell.cellValue = new CellValue(DateTime.Now.ToOADate().ToString()); cell.StyleIndex=5; Here I have used cell.StyleIndex=5; which is By Default Style Index of date in Excel. So no need to add all the external styylesheets Enjoy :) 回答2: So no need

How can I pass an Excel created with XML to PDF MVC

a 夏天 提交于 2019-12-11 20:26:53
问题 I need to create a PDF from an Excel created with XML. My application is based on MVC 4.0. Searching I found ITextSharp but I can't find examples of code or something like that. How can I export to PDF from Excel using ITextSharp? 回答1: First, separate the program from the file format and the API. Excel is a desktop spreadsheet program. XLS and XLSX are binary file formats for storing spreadsheet information. Open XML is a broad subject but usually refers to either the zipped XML file format

Problem with parsing XML with multiple nodes into SQL

一笑奈何 提交于 2019-12-11 19:49:30
问题 I got problem with node called "siBikNetQuery" and next 3 inside 'inquiryHeader'. There is a problem : "The XML parse error 0xc00ce553 occurred on line number 0, near the XML text "". Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1 [Batch Start Line 1] The error description is 'The following tags were not closed: SiBikNet, siBikNetQuery, creditInquiry, inquiryHeader, testDataMarker.'. Msg 8179, Level 16, State 5, Line 42 Could not find prepared statement with handle 0.

add html content in existing docx file using openxml in C#

痞子三分冷 提交于 2019-12-11 17:55:07
问题 How do I add/append HTML content in an existing .docx file, using OpenXML in asp.net C#? In an existing word file, I want to append the html content part. For example: In this example, I want to place "This is a Heading" inside a H1 tag. Here its my code protected void Button1_Click(object sender, EventArgs e) { try { using (WordprocessingDocument doc = WordprocessingDocument.Open(@"C:\Users\admin\Downloads\WordGenerator\WordGenerator\FTANJS.docx", true)) { string altChunkId = "myId";

The easiest way to implement a barchart with 2 columns using apache poi and ooxml-schemas

纵饮孤独 提交于 2019-12-11 17:50:01
问题 I'm trying to create n bar chart of 2 columns in a xlsx file like below. But It's so confuse to me , to understand how the class inside the org.openxmlformats.schemas.drawingml.x2006.chart works. I've already tryied but the generate file does not get the chart that I have drawed. I have this code: Drawing drawing = planilha.createDrawingPatriarch(); ClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 5, 5, 15); Chart chart = drawing.createChart(anchor); CTChart ctChart = ((XSSFChart

Replace text in control content

岁酱吖の 提交于 2019-12-11 17:42:59
问题 I have a word template that I need to change insering some text at some precise spots. I already done an header but I used only the InnerXML and I can try to not use this function it could be better. My code: using (WordprocessingDocument myDoc = WordprocessingDocument.Open(destinationFile, true)) { var mainDocumentPart = myDoc.MainDocumentPart; //Body var body = mainDocumentPart.Document.Body; List<SdtElement> SdtBlocks = myDoc.MainDocumentPart.Document.Descendants<SdtElement>().ToList(); /

how to modify content in filestream while using open xml?

非 Y 不嫁゛ 提交于 2019-12-11 17:39:33
问题 In the code below, I am merging some files together and saving them in the test.docx file. However, before I merg each file, I would like to first replace the text of some content controls which are used as place holders. Can someone show me how to do that? suppose I have one content control in template2 and it is called placeholder1. How can I add text to this placeholder while usig the filestream? string fileName = Path.Combine(@"Docs\templates", "test.docx"); for (int i = 1; i < 3; i++) {

How to set table caption with OpenXML?

本小妞迷上赌 提交于 2019-12-11 17:39:01
问题 I want to set caption to my table: var caption = new TableCaption(); caption.Val = "Test"; table.Append(caption); But nothing happens. Whats wrong here? UPADATE foreach (var tabl in mainPart.Document.Body.Descendants<Table>()) { foreach (var trow in tabl.Elements<TableRow>()) { foreach (var tcell in trow.Elements<TableCell>()) { foreach (var para in tcell.Elements<Paragraph>()) { foreach (var run in para.Elements<Run>()) { foreach (var text in run.Elements<Text>()) { if ( text.Text == "my

How do I create a check box in C# using Open XML SDK

拥有回忆 提交于 2019-12-11 16:33:16
问题 I would like to create a certain number of checkbox using Open XML SDK in C#. How would I do that? Example: (Checkbox) - Shoes (Checkbox) - Shirt The checkbox count also varies. I am reading a template document, then make edits to return. I have something like this so far: string documentText; using (StreamReader reader ...) { documentText = reader.ReadToEnd(); } string addClothes = ""; Run newCheckBox = GenerateRun(); foreach(var item in ClothesList) { addClothes = item.clothing; //MY