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 @@ -27,8 +27,7 @@ public IActionResult LoadingandSaving()
application.DefaultVersion = ExcelVersion.Xlsx;

//Load an existing Excel document
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");

//Access first worksheet from the workbook.
IWorksheet worksheet = workbook.Worksheets[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Function
application.DefaultVersion = ExcelVersion.Xlsx;

//Load an existing Excel document
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");

//Access first worksheet from the workbook
IWorksheet worksheet = workbook.Worksheets[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Function
application.DefaultVersion = ExcelVersion.Xlsx;

//Load an existing Excel document
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");

//Access first worksheet from the workbook
IWorksheet worksheet = workbook.Worksheets[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public ActionResult LoadAndSaveDocument()
application.DefaultVersion = ExcelVersion.Xlsx;

//Load an existing Excel document
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");

//Access first worksheet from the workbook.
IWorksheet worksheet = workbook.Worksheets[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ static void Main(string[] args)

#region Open
//Loads or open an existing workbook through Open method of IWorkbook
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = excelEngine.Excel.Workbooks.Open(inputStream);
IWorkbook workbook = excelEngine.Excel.Workbooks.Open(@"Data/InputTemplate.xlsx");
#endregion

//Set the version of the workbook
Expand All @@ -26,19 +25,14 @@ static void Main(string[] args)

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

#region Close
//Close the instance of IWorkbook
workbook.Close();
#endregion

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();

//Dispose the instance of ExcelEngine
excelEngine.Dispose();
}
Expand Down