Skip to content
Merged
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 @@ -96,8 +96,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
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, ExcelOpenType.Automatic);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];

//Create Template Marker Processor
Expand Down Expand Up @@ -125,13 +124,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
}
{% endhighlight %}

Expand Down Expand Up @@ -196,8 +190,7 @@ You can also add or insert template markers using XlsIO APIs as follows.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream fileStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet sheet = workbook.Worksheets[0];

//Insert Simple marker
Expand All @@ -220,11 +213,9 @@ using (ExcelEngine excelEngine = new ExcelEngine())
//Process the markers in the template
marker.ApplyMarkers();

//Saving the workbook as stream
//Saving the workbook
workbook.Version = ExcelVersion.Excel2013;
FileStream stream = new FileStream("TemplateMarker.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(stream);
stream.Dispose();
workbook.SaveAs("TemplateMarker.xlsx"));
}
{% endhighlight %}

Expand Down Expand Up @@ -315,10 +306,9 @@ The following code snippet illustrates how to detect data type and apply number
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
FileStream fileStream = new FileStream("TemplateMarker.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(fileStream);

//Create Template Marker Processor
IWorkbook workbook = application.Workbooks.Open("TemplateMarker.xlsx");

//Create Template Marker Processor
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();

DataTable reports = new DataTable();
Expand All @@ -338,12 +328,10 @@ using (ExcelEngine excelEngine = new ExcelEngine())
//Process the markers and detect the number format along with the data type in the template
marker.ApplyMarkers();

//Saving the workbook as stream
//Saving the workbook
workbook.Version = ExcelVersion.Excel2013;
workbook.SaveAs(Path.GetFullPath("TemplateMarkerWithFormat.xlsx"));

FileStream stream = new FileStream("TemplateMarkerWithFormat.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(stream);
stream.Dispose();
}
{% endhighlight %}

Expand Down Expand Up @@ -540,8 +528,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
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, ExcelOpenType.Automatic);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];

//Create Template Marker Processor
Expand All @@ -555,13 +542,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
}
{% endhighlight %}

Expand Down Expand Up @@ -848,8 +830,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
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, ExcelOpenType.Automatic);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];

//Create Template Marker Processor
Expand Down Expand Up @@ -955,13 +936,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
}
{% endhighlight %}

Expand Down Expand Up @@ -1248,8 +1224,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
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, ExcelOpenType.Automatic);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];

//Create Template Marker Processor
Expand All @@ -1263,13 +1238,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
}
{% endhighlight %}

Expand Down