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 @@ 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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Filter
Expand All @@ -48,13 +47,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

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

Expand Down Expand Up @@ -120,8 +114,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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Custom Filter
Expand All @@ -142,13 +135,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

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

Expand Down Expand Up @@ -218,8 +206,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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Combination Filter
Expand All @@ -241,13 +228,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

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

Expand Down Expand Up @@ -315,8 +297,7 @@ The following code example illustrates how to apply Dynamic filter.
{
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];

#region Dynamic Filter
Expand All @@ -332,13 +313,8 @@ The following code example illustrates how to apply Dynamic filter.

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

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

Expand Down Expand Up @@ -398,8 +374,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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Cell Color Filter
Expand All @@ -415,13 +390,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

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

Expand Down Expand Up @@ -479,8 +449,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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Font Color Filter
Expand All @@ -496,13 +465,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

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

Expand Down Expand Up @@ -562,8 +526,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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Icon Filter
Expand All @@ -579,13 +542,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

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

Expand Down Expand Up @@ -655,8 +613,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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Advanced Filter
Expand All @@ -670,13 +627,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())

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

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

Expand Down Expand Up @@ -732,8 +684,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);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

#region Accessing Filter
Expand Down Expand Up @@ -781,8 +732,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
}
#endregion

//Dispose streams
inputStream.Dispose();
workbook.SaveAs("Output.xlsx");
}
{% endhighlight %}

Expand Down Expand Up @@ -903,8 +853,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Input.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Access sort fields from AutoFilters
Expand All @@ -931,13 +880,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
sorter.Sort();

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Searches for the given string within the text of worksheet
Expand Down Expand Up @@ -86,10 +85,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
cell.CellStyle.Color = Syncfusion.Drawing.Color.FromArgb(255, 0, 128, 128);
}

//Saving the workbook as stream
FileStream stream = new FileStream(Path.GetFullPath(@"Output/Find.xlsx"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(stream);
stream.Dispose();
//Saving the workbook
workbook.SaveAs(Path.GetFullPath(@"Output/Find.xlsx"));
}
{% endhighlight %}

Expand Down Expand Up @@ -177,8 +174,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(fileStream);
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
IWorksheet worksheet = workbook.Worksheets[0];

//Replaces the given string with another string
Expand All @@ -196,11 +192,9 @@ using (ExcelEngine excelEngine = new ExcelEngine())
//Replaces the given string with Array
worksheet.Replace("Central", new string[] { "Central", "East" }, true);

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

Expand Down
Loading