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,16 +27,10 @@ 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"));

//Saving the workbook as streams
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Sample.csv"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream, ",");

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
//Saving the workbook
workbook.SaveAs(Path.GetFullPath("Output/Sample.csv"), ",");
}
{% endhighlight %}

Expand Down Expand Up @@ -83,16 +77,14 @@ using (ExcelEngine excelEngine = new ExcelEngine())
application.MaximumRowsForCsv = 3000000;
application.MaximumColumnsForCsv = 20000;

FileStream inputStream = new FileStream("Sample.csv", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open("Sample.csv");
IWorksheet sheet = workbook.Worksheets[0];

sheet.Range[2000000, 1].Text = "Syncfusion";
sheet.Range[20, 18000].Text = "Syncfusion";

//Saving the workbook as stream
FileStream outputStream = new FileStream("Output.csv", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream,",");
//Saving the workbook
workbook.SaveAs("Output.csv",",");
}
{% endhighlight %}

Expand Down Expand Up @@ -149,12 +141,10 @@ 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"));

//Save the workbook in CSV format with tab(\t) as delimiter
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.tsv"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream, "\t");
workbook.SaveAs(Path.GetFullPath("Output/Output.tsv"), "\t");
}
{% endhighlight %}

Expand Down
26 changes: 8 additions & 18 deletions Document-Processing/Excel/Conversions/Excel-to-CSV/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ 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"));

//Saving the workbook as streams
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Sample.csv"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream, ",");

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
//Saving the workbook
workbook.SaveAs(Path.GetFullPath("Output/Sample.csv"), ",");
}
{% endhighlight %}

Expand Down Expand Up @@ -83,16 +77,14 @@ using (ExcelEngine excelEngine = new ExcelEngine())
application.MaximumRowsForCsv = 3000000;
application.MaximumColumnsForCsv = 20000;

FileStream inputStream = new FileStream("Sample.csv", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorkbook workbook = application.Workbooks.Open("Sample.csv");
IWorksheet sheet = workbook.Worksheets[0];

sheet.Range[2000000, 1].Text = "Syncfusion";
sheet.Range[20, 18000].Text = "Syncfusion";

//Saving the workbook as stream
FileStream outputStream = new FileStream("Output.csv", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream,",");
//Saving the workbook
workbook.SaveAs("Output.csv",",");
}
{% endhighlight %}

Expand Down Expand Up @@ -149,12 +141,10 @@ 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"));

//Save the workbook in CSV format with tab(\t) as delimiter
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.tsv"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream, "\t");
workbook.SaveAs(Path.GetFullPath("Output/Output.tsv"), "\t");
}
{% endhighlight %}

Expand Down