How to open excel worksheet on aspose cell in existing excel template and write new excel worksheets on existing excel template using asp.net with c#

StackOverflow https://stackoverflow.com/questions/23340329

  •  10-07-2023
  •  | 
  •  

문제

How can i open excel worksheet on aspose cell in existing excel template and write new excel worksheets on existing excel template using asp.net with c# ? kindly give me an examples...

Thanks and regards, Parthiban K.

도움이 되었습니까?

해결책 2

As per your last comment, you can import the data from a datatable (dataset) to a new worksheet in an existing workbook using the following code sample:

//Open the existing workbook
Workbook workbook = new Workbook("book1.xls");

//add new worksheet other than the existing worksheets
Worksheet worksheet = workbook.Worksheets.Add("New Sheet");

//import data from datatable (dataset) to newly created worksheet
//dataTable is the dataset table
worksheet.Cells.ImportDataTable(dataTable, true, "A1");

//save the updated workbook
workbook.Save("book1.xls");

다른 팁

I work as social media developer at Aspose. Use the following sample code to open an existing excel file and add worksheet to it.

//open the template excel file
Workbook wb = new Workbook("input.xls");

//Add new worksheet in existing workbook
Worksheet sheet = wb.Worksheets.Add("New Sheet");

//Access the "A1" cell in the sheet.
Cell cell = sheet.Cells["A1"];

//Input the "Hello World!" text into the "A1" cell
cell.PutValue("Hello World!");

//Save the Excel file.
wb.Save("output.xls");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top