openxml

How to group rows/columns in EPPlus

我们两清 提交于 2019-11-30 18:48:17
Is there a way to achieve this in EPPlus? Only thing I could find on the internet is grouping specific data for example: AAA ---> AAA 5 occurrences AAA BBB 2 occurences BBB BBB AAA AAA AAA but not visually like in the screenshots Looks like you want to do Row and Columns outlines that are collapsed. This should demonstrate how to do that: [TestMethod] public void Row_Col_Grouping_Test() { //http://stackoverflow.com/questions/32760210/how-to-group-rows-columns-in-epplus //Throw in some data var datatable = new DataTable("tblData"); datatable.Columns.AddRange(new[] { new DataColumn("Header",

openXML spreadsheetdocument return byte array for MVC file download

天涯浪子 提交于 2019-11-30 18:29:30
I'm trying to return a openXML spreadsheetdocument as a byte[] which I can then use to allow my MVC to send that file to a user. here is my spreadsheetdocument method to return the byte array using (MemoryStream mem = new MemoryStream()) { SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument. Create(mem, SpreadsheetDocumentType.Workbook); // Add a WorkbookPart to the document. WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart(); workbookpart.Workbook = new Workbook(); // Add a WorksheetPart to the WorkbookPart. WorksheetPart worksheetPart = workbookpart.AddNewPart

OpenXml and Unable to create mutex

隐身守侯 提交于 2019-11-30 18:12:56
问题 I tried to create Excel document through openXml lib, but when i wanna create Excel from large number of data, server shoe me Unable to create mutex. (Exception from HRESULT: 0x80131464) error, the stack trace is : [IsolatedStorageException: Unable to create mutex. (Exception from HRESULT: 0x80131464)] System.IO.IsolatedStorage.IsolatedStorageFile.Open(String infoFile, String syncName) +0 System.IO.IsolatedStorage.IsolatedStorageFile.Lock(Boolean& locked) +370 System.IO.IsolatedStorage

Open XML - How to add a watermark to a docx document

久未见 提交于 2019-11-30 18:10:25
I'm trying to take an existing document and if a header doesn't exist, create one, and then add a watermark to the header that says "DRAFT" diagonally. I've followed an example posted here and I've gotten the code to the point where it will add the watermark if the header already exists. The current issue is when I add a new header, add the reference to the document, and then add the watermark to the header, the document becomes corrupt and can no longer open in Word 2010. To test I've been doing the following: Create a new word document from word itself with text of "TestDoc" in the main part

C# OPEN XML: empty cells are getting skipped while getting data from EXCEL to DATATABLE

天大地大妈咪最大 提交于 2019-11-30 17:41:01
Task Import data from excel to DataTable Problem The cell that doesnot contain any data are getting skipped and the very next cell that has data in the row is used as the value of the empty colum. E.g A1 is empty A2 has a value Tom then while importing the data A1 get the value of A2 and A2 remains empty To make it very clear I am providing some screen shots below This is the excel data This is the DataTable after importing the data from excel Code public class ImportExcelOpenXml { public static DataTable Fill_dataTable(string fileName) { DataTable dt = new DataTable(); using

OpenXML file download without temporary file

南楼画角 提交于 2019-11-30 15:32:51
问题 Is there a way of providing a download in an ASP.Net Page for a freshly generated OpenXML (docx) file without saving it in a temporary folder? On MSDN I only found a tutorial for using a temp file but I thought about using the WordprocessingDocument.MainDocumentPart.GetStream() and directly writing the stream out. 回答1: When you create the document use a MemoryStream as the backing store. Then create and close the document normally and serve the contents of the memory stream to the client.

Automated Testing OpenXML SDK

感情迁移 提交于 2019-11-30 14:57:13
问题 I'm implementing ms word document generation using content controls and OpenXML SDK. I'd like to have some automated testing for that code (unit tests or some easy UI automation tests). Does anyone has expericnce with testing MS Word document generation? What are the possible options? Thanks in advance! 回答1: No, I haven't done unit testing of MS Word Document generation, but as Ingó Vals says, it shouldn't be any different from any other form of unit testing. 1) [Optional - to ensure that you

openXML spreadsheetdocument return byte array for MVC file download

☆樱花仙子☆ 提交于 2019-11-30 14:53:07
问题 I'm trying to return a openXML spreadsheetdocument as a byte[] which I can then use to allow my MVC to send that file to a user. here is my spreadsheetdocument method to return the byte array using (MemoryStream mem = new MemoryStream()) { SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument. Create(mem, SpreadsheetDocumentType.Workbook); // Add a WorkbookPart to the document. WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart(); workbookpart.Workbook = new Workbook(); /

OpenXML file download without temporary file

醉酒当歌 提交于 2019-11-30 14:33:59
Is there a way of providing a download in an ASP.Net Page for a freshly generated OpenXML (docx) file without saving it in a temporary folder? On MSDN I only found a tutorial for using a temp file but I thought about using the WordprocessingDocument.MainDocumentPart.GetStream() and directly writing the stream out. When you create the document use a MemoryStream as the backing store. Then create and close the document normally and serve the contents of the memory stream to the client. using(var stream = new MemoryStream()) { using(var doc = WordprocessingDocument.Create(stream,

Automated Testing OpenXML SDK

爷,独闯天下 提交于 2019-11-30 12:48:14
I'm implementing ms word document generation using content controls and OpenXML SDK. I'd like to have some automated testing for that code (unit tests or some easy UI automation tests). Does anyone has expericnce with testing MS Word document generation? What are the possible options? Thanks in advance! No, I haven't done unit testing of MS Word Document generation, but as Ingó Vals says, it shouldn't be any different from any other form of unit testing. 1) [Optional - to ensure that you understand correct usage of the SDK for your needs]. Work out how your app should drive the SDK. Write some