openxml

highlighting text in Docx using c#

痴心易碎 提交于 2019-12-01 13:14:41
I need to highlight a sentence in docx file, I have this code, and its working fine for many documents , but i noticed that for some document the text inside the document is set word by word, not whole sentence, I mean each word with its own Run, so when searching for that sentence, it is not found because it is word by word in the docx. NOTE: I am working with Arabic text. private void HighLightText_userSentence(Paragraph paragraph, string text, string title, string author, decimal percentage, string _color) { string textOfRun = string.Empty; var runCollection = paragraph.Descendants<Run>();

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

橙三吉。 提交于 2019-12-01 12:58:13
问题 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.

Simple Example of creating a PowerPoint file

早过忘川 提交于 2019-12-01 11:23:17
问题 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

Sample create powerpoint with openxml

有些话、适合烂在心里 提交于 2019-12-01 11:07:47
Where can I find the 'Hello World' with the insert text and image in a ppt file with OpenXML? I'm not able to generate a simple template. Before going to develop a template for PowerPoint, read the presentationML structure from this PDF , Refer the follwing link for creating PPT using OPENXML. How to: Create a presentation document by providing a file name (Open XML SDK) Refer following link for insert image into the PPT Insert image into the PPT File. For Further Examples in OpenXML Refer: OPENXML Developerorg 来源: https://stackoverflow.com/questions/35409323/sample-create-powerpoint-with

Using OpenXML to insert a datatable into excel

我是研究僧i 提交于 2019-12-01 09:35:11
I have a datatable that - depending on the user selection - will generate a dynamic datatable with any number of rows and columns. I'm currently using OpenXml to manipulate said spreadsheet. How would I go about inserting a datatable? Thanks Stu I found some code which I was able to modify to suit my needs. Hope someone finds this useful. public void ExportDataTable(System.Data.DataTable exportData, SheetData sheetData) { //add column names to the first row Row header = new Row(); header.RowIndex = (UInt32)42; SheetData sheetData2 = new SheetData(); foreach (DataColumn column in exportData

Using OpenXML to insert a datatable into excel

耗尽温柔 提交于 2019-12-01 09:16:53
问题 I have a datatable that - depending on the user selection - will generate a dynamic datatable with any number of rows and columns. I'm currently using OpenXml to manipulate said spreadsheet. How would I go about inserting a datatable? Thanks Stu 回答1: I found some code which I was able to modify to suit my needs. Hope someone finds this useful. public void ExportDataTable(System.Data.DataTable exportData, SheetData sheetData) { //add column names to the first row Row header = new Row(); header

Insert picture to header of Word document with OpenXML

岁酱吖の 提交于 2019-12-01 08:12:41
问题 I know that there was same question here, however answers are kinda vague and do not show the full source code. I've got a method for generating a header, but it does not work(shows x on the image place). public static void AddPicHeader(string docxFileName) { using(WordprocessingDocument doc = WordprocessingDocument.Open(docxFileName, true)) { var mainDocPart = doc.MainDocumentPart; var imgPart = mainDocPart.AddImagePart(ImagePartType.Png, "rId999"); var image = GetImageFromFile(logoFileName)

How to disable gridlines in Excel using open xml C#?

老子叫甜甜 提交于 2019-12-01 07:52:58
问题 I want to disable GridLines in excel and put custom borders to excel cells using open xml in C# I have tried with below code but is throwing exception when i open the excell, the exception is "Repaired Part: /xl/worksheets/sheet.xml part with XML error. Load error. Line 1, column 0." using (SpreadsheetDocument xl = SpreadsheetDocument.Create(sFile, SpreadsheetDocumentType.Workbook)) { WorkbookPart wbp = xl.AddWorkbookPart(); WorksheetPart wsp = wbp.AddNewPart<WorksheetPart>(); Workbook wb =

Sample create powerpoint with openxml

懵懂的女人 提交于 2019-12-01 06:57:55
问题 Where can I find the 'Hello World' with the insert text and image in a ppt file with OpenXML? I'm not able to generate a simple template. 回答1: Before going to develop a template for PowerPoint, read the presentationML structure from this PDF, Refer the follwing link for creating PPT using OPENXML. How to: Create a presentation document by providing a file name (Open XML SDK) Refer following link for insert image into the PPT Insert image into the PPT File. For Further Examples in OpenXML

What is the best / fastest way to export large set of data from C# to excel

时光毁灭记忆、已成空白 提交于 2019-12-01 05:57:31
问题 I have code that uses the OpenXML library to export data. I have 20,000 rows and 22 columns and it takes ages (about 10 minutes). is there any solution that would export data from C# to excel that would be faster as i am doing this from an asp.net mvc app and many people browsers are timing out. 回答1: Assuming 20'000 rows and 22 columns with about 100 bytes each, makes 41 megabytes data alone. plus xml tags, plus formatting, I'd say you end up zipping (.xlsx is nothing but several zipped xml