Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ static void Main(string[] args)
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Creating a table
Expand All @@ -27,13 +26,8 @@ static void Main(string[] args)

#region Save
//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/AddTotalRow.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
workbook.SaveAs(Path.GetFullPath("Output/AddTotalRow.xlsx"));
#endregion

//Dispose streams
inputStream.Dispose();
outputStream.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,8 @@ static void Main(string[] args)

#region Save
//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/CustomTableStyle.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
workbook.SaveAs(Path.GetFullPath("Output/CustomTableStyle.xlsx"));
#endregion

//Dispose streams
outputStream.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,16 @@ static void Main(string[] args)
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Create for the given data
IListObject table = worksheet.ListObjects.Create("Table1", worksheet["A1:C5"]);

#region Save
//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/CreateTable.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
workbook.SaveAs(Path.GetFullPath("Output/CreateTable.xlsx"));
#endregion

//Dispose streams
inputStream.Dispose();
outputStream.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ static void Main(string[] args)
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Creating a table
Expand All @@ -24,13 +23,8 @@ static void Main(string[] args)

#region Save
//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/FormatTable.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
workbook.SaveAs(Path.GetFullPath("Output/FormatTable.xlsx"));
#endregion

//Dispose streams
inputStream.Dispose();
outputStream.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ static void Main(string[] args)
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Creating a table
Expand All @@ -24,13 +23,8 @@ static void Main(string[] args)

#region Save
//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/InsertTableColumn.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
workbook.SaveAs(Path.GetFullPath("Output/InsertTableColumn.xlsx"));
#endregion

//Dispose streams
inputStream.Dispose();
outputStream.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ static void Main(string[] args)
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Accessing first table in the sheet
Expand All @@ -24,13 +23,8 @@ static void Main(string[] args)

#region Save
//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/ReadTable.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
workbook.SaveAs(Path.GetFullPath("Output/ReadTable.xlsx"));
#endregion

//Dispose streams
inputStream.Dispose();
outputStream.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ static void Main(string[] args)
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Creating a table
Expand All @@ -24,13 +23,8 @@ static void Main(string[] args)

#region Save
//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/RemoveTableColumn.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
workbook.SaveAs(Path.GetFullPath("Output/RemoveTableColumn.xlsx"));
#endregion

//Dispose streams
inputStream.Dispose();
outputStream.Dispose();
}
}
}
Expand Down