openxml-sdk

How can I retrieve images from a .pptx file using MS Open XML SDK?

南楼画角 提交于 2019-12-30 09:33:03
问题 I started experimenting with Open XML SDK 2.0 for Microsoft Office. I'm currently able to do certain things such as retrieve all texts in each slide, and get the size of the presentation. For example, I do the latter this way: using (var doc = PresentationDocument.Open(pptx_filename, false)) { var presentation = doc.PresentationPart.Presentation; Debug.Print("width: " + (presentation.SlideSize.Cx / 9525.0).ToString()); Debug.Print("height: " + (presentation.SlideSize.Cy / 9525.0).ToString());

How can I retrieve images from a .pptx file using MS Open XML SDK?

谁都会走 提交于 2019-12-30 09:32:27
问题 I started experimenting with Open XML SDK 2.0 for Microsoft Office. I'm currently able to do certain things such as retrieve all texts in each slide, and get the size of the presentation. For example, I do the latter this way: using (var doc = PresentationDocument.Open(pptx_filename, false)) { var presentation = doc.PresentationPart.Presentation; Debug.Print("width: " + (presentation.SlideSize.Cx / 9525.0).ToString()); Debug.Print("height: " + (presentation.SlideSize.Cy / 9525.0).ToString());

OpenXML to Create a DataTable from Excel - Money Cell Value Incorrect

断了今生、忘了曾经 提交于 2019-12-29 09:14:07
问题 I am attempting to create a datatable from an Excel spreadsheet using OpenXML. When getting a row's cell value using Cell.CellValue.innerXml the value returned for a monetary value entered by the user and visible on the spreadsheet is not the same value interpreted. The spreadsheet cell is formatted as Text and the cell value is 570.81. When obtaining the data in OpenXML the value is interpreted as 570.80999999999995. This method is used for many different excel imports where the data type

open xml excel Insert actual value in the placeholder

若如初见. 提交于 2019-12-29 06:27:06
问题 I have a cell that contains the placeholder "$$value" in the Excel sheet, the thing is that I need to replace the placeholder's actual value using Open XML and save it as separate workbook. Here is the code that I tried...it is not replacing the actual value and also I'm unable to save the workbook. I need to sort out this issue. WorksheetPart worksheetPart = (WorksheetPart)myWorkbook.WorkbookPart.GetPartById(sheet.Id); DocumentFormat.OpenXml.Spreadsheet.Worksheet worksheet = worksheetPart

How to create Excel file using OpenXML without creating a local file?

血红的双手。 提交于 2019-12-28 05:58:11
问题 Is it possible to create and edit an excel document using OpenXML SDK without creating a local file? As per the documentation the Create method demands for a filepath , which creates a local copy of the file. SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Create(filepath, SpreadsheetDocumentType.Workbook); I'm referring the MSDN article here: https://msdn.microsoft.com/en-us/library/office/ff478153.aspx My requirement is to create the file, and it should be downloaded by the

create a new document from word template with multiple pages using documentformat.openxml

橙三吉。 提交于 2019-12-25 17:45:05
问题 I have a Microsoft Word template with some content controls. It contains a table of contents and some extra information. On the page, I have set some content controls where I would like to inject a new text from a RESTful service. If the RESTful service returns an array of data (objects), I need to replicate the information on each page based on the Word template. Any idea on how can I do that using the Open XML SDK ( DocumentFormat.OpenXml )? Edit: I found this post here, which is great, but

Write large amount of data to excel c#

两盒软妹~` 提交于 2019-12-25 07:26:08
问题 I need to export lots of data from database table to excel (xls/xlsx) file. It could be easily 10million rows and more. I need open source solution which does not require Office to be installed (SpreadsheetGear and interop solutions will not work for me). I am checking two libraries: OpenXML SDK and EPPlus. For OpenXML SDK I found this method: private static void Write(string fileName, int numRows, int numCols) { using (var spreadsheetDocument = SpreadsheetDocument.Open(fileName, true)) {

Open XML SDK page margins

落花浮王杯 提交于 2019-12-25 06:50:02
问题 I am trying to set the page margins on an excel spreadsheet that is being generated by open xml sdk. I am not opening an excel document that already exists, it is generated from scratch. I am using the PageMargins class but am not sure how to attach this instance to the worksheet. The SDK productivity tool gives this code: PageMargins pageMargins1 = worksheet.GetFirstChild<PageMargins>(); pageMargins1.Left = 0.45D; pageMargins1.Right = 0.45D; pageMargins1.Top = 0.5D; pageMargins1.Bottom = 0

How to make a powerpoint chart reflect changes to its data source?

允我心安 提交于 2019-12-25 06:24:28
问题 I'm using openxml sdk 2 to change the excel data from a chart on a powerpoint file (2007). I can change the data but when I open the changed file on powerpoint, the chart shows the original data. Only when I choose "Edit data", it shows the excel sheet with the correct data and the chart is updated. How can I make the chart reflect the underlying changes? 回答1: It sounds as though you have an embedded chart rather than a linked one. With an embedded chart, the chart and the spreadsheet behind

How to build custom sentences with OpenXML

醉酒当歌 提交于 2019-12-25 05:16:16
问题 I would like to know if there is a way to "play" with sentences in a .docx. Here's what I need to do: I have a paragraph in a document exemple of my paragraph: This is a paragraph that I need to format based on some conditions and I can't figure how to do this with openxml sdk. end of exemple. So based on a condition that I evaluate in c# I would like to add/remove the text. Another thing that you should know id that I would like the product owner to change the text of the document. Basicly