Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

924528-Add-Readme-Files #154

Merged
merged 1 commit into from
Dec 11, 2024
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
38 changes: 38 additions & 0 deletions CSV to Excel/CSV to Excel/.NET/CSV to Excel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# How to convert a CSV to an Excel file??

Step 1: Create a new C# Console Application project.

Step 2: Name the project.

Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).

Step 4: Include the following namespaces in the **Program.cs** file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using Syncfusion.XlsIO;
{% endhighlight %}
{% endtabs %}

Step 5: Include the below code snippet in **Program.cs** to convert a CSV to an Excel fil.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.csv"), FileMode.Open, FileAccess.Read);

//Open the CSV file
IWorkbook workbook = application.Workbooks.Open(inputStream, ",");
IWorksheet worksheet = workbook.Worksheets[0];

//Saving the workbook as stream
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
}
{% endhighlight %}
{% endtabs %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# How to convert an Excel workbook to a JSON file with schema?

Step 1: Create a new C# Console Application project.

Step 2: Name the project.

Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).

Step 4: Include the following namespaces in the **Program.cs** file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using System;
using System.IO;
using Syncfusion.XlsIO;
{% endhighlight %}
{% endtabs %}

Step 5: Include the below code snippet in **Program.cs** to convert an Excel workbook to a JSON file with schema.
{% tabs %}
{% highlight c# tabtitle="C#" %}
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);
IWorksheet worksheet = workbook.Worksheets[0];

#region save as JSON
//Saves the workbook to a JSON filestream, as schema by default
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema-default.json"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAsJson(outputStream);

//Saves the workbook to a JSON filestream as schema
FileStream stream1 = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema.json"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAsJson(stream1, true);
#endregion

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

#region Open JSON
//Open default JSON

//Open JSON with Schema
#endregion
}
{% endhighlight %}
{% endtabs %}
68 changes: 68 additions & 0 deletions Create and Edit Charts/Create Chart/.NET/Create Chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# How to create a chart in the worksheet?

Step 1: Create a new C# Console Application project.

Step 2: Name the project.

Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).

Step 4: Include the following namespaces in the **Program.cs** file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using System.IO;
using Syncfusion.XlsIO;
{% endhighlight %}
{% endtabs %}

Step 5: Include the below code snippet in **Program.cs** to create a chart in the worksheet.
{% tabs %}
{% highlight c# tabtitle="C#" %}
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);
IWorksheet sheet = workbook.Worksheets[0];

//Create a Chart
IChartShape chart = sheet.Charts.Add();

//Set Chart Type
chart.ChartType = ExcelChartType.Column_Clustered;

//Set data range in the worksheet
chart.DataRange = sheet.Range["A1:C6"];
chart.IsSeriesInRows = false;

//Set Datalabels
IChartSerie serie1 = chart.Series[0];
IChartSerie serie2 = chart.Series[1];

serie1.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
serie2.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
serie1.DataPoints.DefaultDataPoint.DataLabels.Position = ExcelDataLabelPosition.Outside;
serie2.DataPoints.DefaultDataPoint.DataLabels.Position = ExcelDataLabelPosition.Outside;

//Set Legend
chart.HasLegend = true;
chart.Legend.Position = ExcelLegendPosition.Bottom;

//Positioning the chart in the worksheet
chart.TopRow = 8;
chart.LeftColumn = 1;
chart.BottomRow = 23;
chart.RightColumn = 8;

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

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
}
{% endhighlight %}
{% endtabs %}
43 changes: 43 additions & 0 deletions Create and Edit Table/Create Table/.NET/Create Table/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# How to create a table in the worksheet?

Step 1: Create a new C# Console Application project.

Step 2: Name the project.

Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).

Step 4: Include the following namespaces in the **Program.cs** file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using System;
using System.IO;
using Syncfusion.XlsIO;
{% endhighlight %}
{% endtabs %}

Step 5: Include the below code snippet in **Program.cs** to create a table in the worksheet.
{% tabs %}
{% highlight c# tabtitle="C#" %}
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);
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);
#endregion

//Dispose streams
inputStream.Dispose();
outputStream.Dispose();
}
{% endhighlight %}
{% endtabs %}
50 changes: 50 additions & 0 deletions Data Validation/List Validation/.NET/List Validation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# How to set list data validation in Excel?

Step 1: Create a new C# Console Application project.

Step 2: Name the project.

Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).

Step 4: Include the following namespaces in the **Program.cs** file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using System.IO;
using Syncfusion.XlsIO;
{% endhighlight %}
{% endtabs %}

Step 5: Include the below code snippet in **Program.cs** to set list data validation in Excel.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];

//Data Validation for List
IDataValidation listValidation = worksheet.Range["C3"].DataValidation;
worksheet.Range["C1"].Text = "Data Validation List in C3";
worksheet.Range["C1"].AutofitColumns();
listValidation.ListOfValues = new string[] { "ListItem1", "ListItem2", "ListItem3" };

//Shows the error message
listValidation.ErrorBoxText = "Choose the value from the list";
listValidation.ErrorBoxTitle = "ERROR";
listValidation.PromptBoxText = "Data validation for list";
listValidation.IsPromptBoxVisible = true;
listValidation.ShowPromptBox = true;

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

//Dispose streams
outputStream.Dispose();
}
{% endhighlight %}
{% endtabs %}
35 changes: 35 additions & 0 deletions Excel to CSV/Excel to CSV/.NET/Excel to CSV/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# How to convert an Excel file to CSV?

Step 1: Create a new C# Console Application project.

Step 2: Name the project.

Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).

Step 4: Include the following namespaces in the **Program.cs** file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using Syncfusion.XlsIO;
{% endhighlight %}
{% endtabs %}

Step 5: Include the below code snippet in **Program.cs** to convert an Excel file to CSV.
{% tabs %}
{% highlight c# tabtitle="C#" %}
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);

//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();
}
{% endhighlight %}
{% endtabs %}
46 changes: 46 additions & 0 deletions Excel to PDF/Workbook to PDF/.NET/Workbook to PDF/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# How to convert an Excel workbook to PDF?

Step 1: Create a new C# Console Application project.

Step 2: Name the project.

Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).

Step 4: Include the following namespaces in the **Program.cs** file.
{% tabs %}
{% highlight c# tabtitle="C#" %}
using System.IO;
using Syncfusion.XlsIO;
using Syncfusion.XlsIORenderer;
using Syncfusion.Pdf;
{% endhighlight %}
{% endtabs %}

Step 5: Include the below code snippet in **Program.cs** to convert an Excel workbook to PDF.
{% tabs %}
{% highlight c# tabtitle="C#" %}
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);

//Initialize XlsIO renderer.
XlsIORenderer renderer = new XlsIORenderer();

//Convert Excel document into PDF document
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);

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

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