Copy excel template and edit in memory using OpenXML [duplicate] - c#

This question already has answers here:
How do I export to Excel?
(3 answers)
Export DataTable to Excel with EPPlus
(5 answers)
Closed 4 years ago.
My requirement is to open an excel template and edit in memory and then download to user. This needs to be done in .net MVC web project so I tend to use OpenXML instead of InterOp.
The whole idea is I have an excel template which has two sheets. Second sheet contains a set of datasources which I have bound as a range selector in first sheet cells. Now, based on which user is logged in, I need to change the data in datasources and same will be reflected into the first sheet.
This template is added into the project. For concurrency, I don't want to edit this template. I am thinking to either make a copy of this and download it to temp or best if I can take the snapshot of this template in memory and edit the sheet to and then stream it to the response for user to download.
Any help, links, articles based on OpenXML SDK will be really helpful.

Related

Read data from word document in .NET [duplicate]

This question already has answers here:
How to read Microsoft Word documents in .NET? [closed]
(5 answers)
Closed 2 years ago.
I have a requirement to read/parse data collected inside a word document using ASP.NET / C#. I need to store the collected data (not the word document) inside a rational database. The word document has checkbox and drop down controls to capture the data.
I have access to the word document so I can update the document to add any extra tag/hints if required.
Is it possible to parse a word document using .Net?
Install the Microsoft.Office.Interop.Word nuget package.

Best way to export data to Excel [duplicate]

This question already has answers here:
How can I export data to an Excel file
(7 answers)
Closed 7 years ago.
I am new to C#. I am currently learning how to write a window form application. I want to export some of my data from my form to an Excel file.
I am wondering what is the best way to approach this problem?
I have looked through many tutorial site and YouTube video and most of them suggest to use a data grid view. One thing I notice is that datagridview work well with simple GUI layout like the textbox.
However, what if I have some other complicated components such as a checkbox and a comboBox in my form?
Data grid view seems not the best option to do it. Are there any other better solutions to this case?
The approach depends on the desired result. As far as I know, Excel is able to import from a delimiter-separated text file. Depending on the context, it might be a valid approach to programmatically write to a text file which is then read by Excel.

How To Determine Which Version of Excel last saved a Workbook [duplicate]

This question already has answers here:
How can I check the version of Excel files in C#?
(3 answers)
Closed 7 years ago.
I have some excel files (.xls) that is being automatically generated from some system, and I am distributing these files to some users and they edit some fields in it and send it back to me.
I need to know from each file they sent me which version of excel they are using (is it office 2003, 2007, 2010, 2013...?) because I want to know what is the lowest versions I need to keed support for.
Is there a way to take these files and get the excel version that saved each one of them ?
I tried this solution Programmatically finding an Excel file's Excel version but it didn't do it...
I believe this is what you are looking for, at least it worked fine for my application.
var excelWB = new OleDocumentPropertiesClass();
excelWB.Open(FilePath, false, dsoFileOpenOptions.dsoOptionDefault);
string FileUsedVersion = excelWB.SummaryProperties.Version.ToString();
Greetings

asp.net + c# tips to edit docx inside my app [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Open/handle Word documents like SharePoint
I´ve developed one website where it is possible to upload docx files to it. Now I want a way to edit it directly in browser, I meant, a way to do like google docs does.
OR
Copy from MSWord to my app window e maintain all the formats, including tables.
for the manipulation of word documents you can use DocX. With this you can read/write from/to word documents (docx not doc). This however is a long way from editing your document in a google docs like manner...
It does match your second request though!

Reading an Excel Sheet containing 10000 Rows In C# [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Reading Excel Files as a Server Process
While the Jet OleDB Driver is pretty simple to use for reading an Excel sheet, it simply cant handle excel files having rows more than a thousand.
Is there any other way of reading more than 5-10k rows from an excel sheet in C#?
If it is an ooxml file you can use open xml sdk. It is not as straightforward as the oledb driver, but it is possible.
If you can transform the excel-sheet to a csv-file, you can use Filehelpers. This can handle 100K+ records.

Categories