openxml

how can I put a content in a mergefield in docx

血红的双手。 提交于 2019-12-01 19:53:31
I'm developing a web application with asp.net and I have a file called Template.docx that works like a template to generate other reports. Inside this Template.docx I have some MergeFields (Title, CustomerName, Content, Footer, etc) to replace for some dynamic content in C#. I would like to know, how can I put a content in a mergefield in docx ? I don't know if MergeFields is the right way to do this or if there is another way. If you can suggest me, I appreciate! PS: I have openxml referenced in my web application. Edits: private MemoryStream LoadFileIntoStream(string fileName) { MemoryStream

Printing an OOXML document without MS Word installed

大兔子大兔子 提交于 2019-12-01 19:18:58
Is there any way to print an OOXML document (.docx file) without having MS Word installed? It works nicely via the MS Word interface but I need to find a way to use it on servers where MS Word is not installed. I've been digging through the API and haven't found anything obvious so I'm inclined to believe there isn't a way. Is this the case? EDIT: Devin's answer is basically what I understood to be the case. I should have mentioned that I'm using the .NET framework. So I wondered if there is perhaps a .NET library which would be able to be handle a docx file for printing? I see when adding a

Printing an OOXML document without MS Word installed

妖精的绣舞 提交于 2019-12-01 18:01:52
问题 Is there any way to print an OOXML document (.docx file) without having MS Word installed? It works nicely via the MS Word interface but I need to find a way to use it on servers where MS Word is not installed. I've been digging through the API and haven't found anything obvious so I'm inclined to believe there isn't a way. Is this the case? EDIT: Devin's answer is basically what I understood to be the case. I should have mentioned that I'm using the .NET framework. So I wondered if there is

EPPlus Pivot Table - Collapse entire field

我们两清 提交于 2019-12-01 18:00:51
Does anyone know how to do this? I'm using EPPlus in .Net and have created a pivot table with 2 row fields and one summary datafield: Dim Pivot As OfficeOpenXml.Table.PivotTable.ExcelPivotTable Pivot = wksPivot.PivotTables.Add(wksPivot.Cells("A1"), Datarange, "pName") Pivot.RowFields.Add(Pivot.Fields("Fld1")).Sort = Table.PivotTable.eSortType.Ascending Pivot.RowFields.Add(Pivot.Fields("Fld2")).Sort = Table.PivotTable.eSortType.Ascending Dim dtaFld As OfficeOpenXml.Table.PivotTable.ExcelPivotTableDataField dtaFld = Pivot.DataFields.Add(Pivot.Fields("XYZ")) dtaFld.Function = Table.PivotTable

OpenXml Excel: throw error in any word after mail address

北慕城南 提交于 2019-12-01 17:42:45
I read Excel files using OpenXml. all work fine but if the spreadsheet contains one cell that has an address mail and after it a space and another word, such as: abc@abc.com abc It throws an exception immediately at the opening of the spreadsheet: var _doc = SpreadsheetDocument.Open(_filePath, false); exception: DocumentFormat.OpenXml.Packaging.OpenXmlPackageException Additional information: Invalid Hyperlink: Malformed URI is embedded as a hyperlink in the document. There is an open issue on the OpenXml forum related to this problem: Malformed Hyperlink causes exception In the post they talk

How to read the xls and xlsx files using c#

廉价感情. 提交于 2019-12-01 15:13:06
How to read the xls and xlsx files using c# with OpenXML format Without using the OLEDB connection . I am looking for Open XML format procedure. Below is the code in which I used the OLEDB preocedure. But I am looking for OpenXML format. public static DataTable ConvretExcelToDataTable(string FilePath) { string strConn = string.Empty; if (FilePath.Trim().EndsWith(".xlsx")) { strConn = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";", FilePath); } else if (FilePath.Trim().EndsWith(".xls")) { strConn = string.Format("Provider

Shared Strings in Excel 2010

橙三吉。 提交于 2019-12-01 14:39:41
问题 Can someone help me in understanding the Shared Strings in MS Excel ? I tried to understand using some blogs but could not get complete idea. Everyone is explaining how to access Shared String using Open XML and where the Shared Strings stored (as sharedStrings.xml ). Accessing using API is fine. But, How to create Shared Strings in Excel . (Creating manually in Excel 2010 , not using API) What is the exact need of Shared Strings? In which cases i can go for Shared Strings? I tried following.

create dynamic table in powerpoint using openXML with c# and ASP.net

十年热恋 提交于 2019-12-01 14:31:37
I have used these links and got a working code where I can use a template report(containing placeolders) and generate new PPTX report with data I get from database. I have 4 more placeholders where I need to populate 4 different data tables. Currently I am using that template to create new slide and replacing placeholder for text but for tables I couldn't figure out. I am able to generate the table using below code but not in placeholder's location. Table always appear in center of screen. Links used: https://blogs.msdn.microsoft.com/brian_jones/2008/11/18/creating-a-presentation-report-based

How to read the xls and xlsx files using c#

风流意气都作罢 提交于 2019-12-01 14:04:23
问题 How to read the xls and xlsx files using c# with OpenXML format Without using the OLEDB connection . I am looking for Open XML format procedure. Below is the code in which I used the OLEDB preocedure. But I am looking for OpenXML format. public static DataTable ConvretExcelToDataTable(string FilePath) { string strConn = string.Empty; if (FilePath.Trim().EndsWith(".xlsx")) { strConn = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES

Simple Example of creating a PowerPoint file

允我心安 提交于 2019-12-01 13:31:44
I'm looking for some sample code on how to add an image and text & output it as a PowerPoint file. The host server does not have Office and I'm not allowed to install anything so the "Manipulating Excel 2007 and PowerPoint 2007 Files with the Open XML Format API " will not help me. Below is the code the output the PowerPoint. I just don't know of to add text and images. Response.ClearContent(); Response.AddHeader("content-disposition", "attachment;filename=Filename.ppt"); Response.ContentType = "application/powerpoint"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI