Aspose
Aspse. Cells can manipulate Excel and are not dependent on the system environment.
Using templates to output data sources by binding
This is suitable for non-specific format requirements, directly binding the data source. Is the same as a data-bound control.
New= Tablename;designer. Setdatasource (DT);d Esigner. Setdatasource ("title", title);d Esigner. Process ();
Designer. Workbook.save (filename);
As above, use a DataTable as the fill data source.
Progressive output through code
There are special requirements for the number, flexibility is strong. You can complete the merging of cells, and so on.
The first step, Workbook
New Aspose.Cells.Workbook ();
If you use a template, you can further open the template.
Wb. Open (Templetepath);
Step two, Worksheet.
Aspose.Cells.Worksheet sheet = wb. worksheets[0];
Step three, write the data
column]. Putvalue (value);
Output picture
var pictures = sheet. Pictures;
New System.IO.MemoryStream (byte[]));/* Set picture format, with cell width and height */
1]. Placement =1]. Height); sheet. Cells.setcolumnwidthpixel (column, width);
Aspose. Cells Export Excel