Initial commit of the ClosedXML library
Establishes the foundational structure, core Excel functionality, and tooling. - Implements base components for cells, ranges, columns, and rows. - Integrates a custom calculation engine with a wide range of Excel functions. - Adds comprehensive support for styling, conditional formatting, data validation, comments, pictures, and charts. - Configures build setup, project metadata (NuGet), and developer guidelines. - Includes editor and Git attributes for consistent code style and line endings.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System.Linq;
|
||||
using ClosedXML.Excel;
|
||||
|
||||
|
||||
namespace ClosedXML_Examples.Misc
|
||||
{
|
||||
public class MultipleSheets : IXLExample
|
||||
{
|
||||
|
||||
public void Create(string filePath)
|
||||
{
|
||||
var wb = new XLWorkbook();
|
||||
foreach (var wsNum in Enumerable.Range(1, 5))
|
||||
{
|
||||
wb.Worksheets.Add("Original Pos. is " + wsNum.ToString());
|
||||
}
|
||||
|
||||
// Move first worksheet to the last position
|
||||
wb.Worksheet(1).Position = wb.Worksheets.Count() + 1;
|
||||
|
||||
// Delete worksheet on position 4 (in this case it's where original position = 5)
|
||||
wb.Worksheet(4).Delete();
|
||||
|
||||
// Swap sheets in positions 1 and 2
|
||||
wb.Worksheet(2).Position = 1;
|
||||
|
||||
wb.SaveAs(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user