Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
How to add a sheet as a first sheet in a excel sheet while exporting excel .
.Existing sheet having 2 sheets already.Now i wants to add a new sheet in that excel while exporting excel using openxml.

What I have tried:

https://msdn.microsoft.com/en-us/library/office/cc881781.aspx


solution in this link adding a sheet . but not first it adding as a last sheet in excel
Posted
Updated 28-Sep-16 23:59pm
v3
Comments
Karthik_Mahalingam 29-Sep-16 6:18am    
openxml or introp ?

1 solution

Haven't tried to do this, but looking at few suggestions found on the web, you can try something like-
C#
workbook.Sheets.Add(Before: workbook.Sheets[0]);

Check following links for further information-
c# - Excel Interop - Add a new worksheet after all of the others - Stack Overflow[^]
Worksheet.Move Method (Microsoft.Office.Tools.Excel)[^]

Hope, it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900