diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md
index f3303c374..a7e98a474 100644
--- a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md
+++ b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md
@@ -586,7 +586,7 @@ To resolve this issue, we can install the chromium using the docker file and set
Docker File:
{% tabs %}
-{% highlight}
+{% highlight c# tabtitle="C#" %}
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
@@ -612,7 +612,7 @@ Docker File:
Code snippet:
-{% highlight}
+{% highlight c# tabtitle="C#" %}
BlinkConverterSettings settings = new BlinkConverterSettings();
@@ -620,8 +620,6 @@ Code snippet:
settings.BlinkPath = @"/usr/lib/chromium/chromium";
-
-
{% endhighlight %}
{% endtabs %}
diff --git a/File-Formats/Presentation/Presentation-to-PDF.md b/File-Formats/Presentation/Presentation-to-PDF.md
index b740f01a5..556f6e98f 100644
--- a/File-Formats/Presentation/Presentation-to-PDF.md
+++ b/File-Formats/Presentation/Presentation-to-PDF.md
@@ -12,6 +12,9 @@ PowerPoint allows you to convert an entire Presentation or a single slide into P
* [Assemblies Information](https://help.syncfusion.com/file-formats/presentation/assemblies-required)
* [NuGet Information](https://help.syncfusion.com/file-formats/presentation/nuget-packages-required#converting-powerpoint-presentation-into-pdf)
+To quickly start converting a PowerPoint Presentation to a PDF using .NET PowerPoint libray, please check out this video:
+{% youtube "https://www.youtube.com/watch?v=nytscOICpWk" %}
+
[PresentationToPdfConverter](https://help.syncfusion.com/cr/file-formats/Syncfusion.PresentationToPdfConverter.PresentationToPdfConverter.html) class is responsible for converting an entire Presentation or a slide into PDF. The following code example demonstrates how to convert a PowerPoint presentation to PDF.
{% tabs %}
diff --git a/File-Formats/XlsIO/Working-with-Charts.md b/File-Formats/XlsIO/Working-with-Charts.md
index 2cb2c51b0..5eaa23fae 100644
--- a/File-Formats/XlsIO/Working-with-Charts.md
+++ b/File-Formats/XlsIO/Working-with-Charts.md
@@ -2320,36 +2320,63 @@ The following code examples illustrate how to position the chart elements.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
-//Manually positioning plot area
+//Manually positioning chart plot area using Layout
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.inner;
chart.PlotArea.Layout.LeftMode = LayoutModes.edge;
chart.PlotArea.Layout.TopMode = LayoutModes.edge;
-//Manually positioning chart legend
+//Manually positioning chart plot area using Manual Layout
+chart.PlotArea.Layout.ManualLayout.LayoutTarget = LayoutTargets.inner;
+chart.PlotArea.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+chart.PlotArea.Layout.ManualLayout.TopMode = LayoutModes.edge;
+
+//Manually positioning chart legend area using Layout
chart.Legend.Layout.LeftMode = LayoutModes.edge;
chart.Legend.Layout.TopMode = LayoutModes.edge;
+
+//Manually positioning chart legend area using Manual Layout
+chart.Legend.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+chart.Legend.Layout.ManualLayout.TopMode = LayoutModes.edge;
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Manually positioning plot area
+//Manually positioning chart plot area using Layout
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.inner;
chart.PlotArea.Layout.LeftMode = LayoutModes.edge;
chart.PlotArea.Layout.TopMode = LayoutModes.edge;
-//Manually positioning chart legend
+//Manually positioning chart plot area using Manual Layout
+chart.PlotArea.Layout.ManualLayout.LayoutTarget = LayoutTargets.inner;
+chart.PlotArea.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+chart.PlotArea.Layout.ManualLayout.TopMode = LayoutModes.edge;
+
+//Manually positioning chart legend area using Layout
chart.Legend.Layout.LeftMode = LayoutModes.edge;
chart.Legend.Layout.TopMode = LayoutModes.edge;
+
+//Manually positioning chart legend area using Manual Layout
+chart.Legend.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+chart.Legend.Layout.ManualLayout.TopMode = LayoutModes.edge;
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Manually positioning plot area
+'Manually positioning chart plot area using Layout
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.inner
chart.PlotArea.Layout.LeftMode = LayoutModes.edge
chart.PlotArea.Layout.TopMode = LayoutModes.edge
-'Manually positioning chart legend
+'Manually positioning chart plot area using Manual Layout
+chart.PlotArea.Layout.ManualLayout.LayoutTarget = LayoutTargets.inner;
+chart.PlotArea.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+chart.PlotArea.Layout.ManualLayout.TopMode = LayoutModes.edge;
+
+'Manually positioning chart legend area using Layout
chart.Legend.Layout.LeftMode = LayoutModes.edge
chart.Legend.Layout.TopMode = LayoutModes.edge
+
+'Manually positioning chart legend area using Manual Layout
+chart.Legend.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+chart.Legend.Layout.ManualLayout.TopMode = LayoutModes.edge;
{% endhighlight %}
{% endtabs %}
@@ -2395,45 +2422,171 @@ The following code examples illustrate how to resize chart elements such as plot
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
-//Manually resizing chart plot area
-chart.PlotArea.Layout.Left = 50;
-chart.PlotArea.Layout.Top = 75;
-chart.PlotArea.Layout.Width = 300;
+//Manually resizing chart plot area using Layout
+chart.PlotArea.Layout.Left = 70;
+chart.PlotArea.Layout.Top = 40;
+chart.PlotArea.Layout.Width = 280;
chart.PlotArea.Layout.Height = 200;
-//Manually resizing chart legend
+//Manually resizing chart plot area using Manual Layout
+chart.PlotArea.Layout.ManualLayout.Height = 0.80;
+chart.PlotArea.Layout.ManualLayout.Width = 0.65;
+chart.PlotArea.Layout.ManualLayout.Top = 0.03;
+chart.PlotArea.Layout.ManualLayout.Left = -0.1;
+
+//Manually resizing chart legend area using Layout
chart.Legend.Layout.Left = 400;
chart.Legend.Layout.Top = 150;
chart.Legend.Layout.Width = 150;
chart.Legend.Layout.Height = 100;
+
+//Manually resizing chart legend area using Manual Layout
+chart.Legend.Layout.ManualLayout.Height = 0.09;
+chart.Legend.Layout.ManualLayout.Width = 0.30;
+chart.Legend.Layout.ManualLayout.Top = 0.36;
+chart.Legend.Layout.ManualLayout.Left = 0.68;
+
+//Manually resizing chart title area using Layout
+chart.ChartTitleArea.Text = "Sample Chart";
+chart.ChartTitleArea.Layout.Top = 10;
+chart.ChartTitleArea.Layout.Left = 150;
+
+//Manually resizing chart title area using Manual Layout
+chart.ChartTitleArea.Text = "Sample Chart";
+chart.ChartTitleArea.Layout.ManualLayout.Top = 0.005;
+chart.ChartTitleArea.Layout.ManualLayout.Left = 0.26;
+
+//Manually resizing axis title area using Layout
+chart.PrimaryValueAxis.TitleArea.Layout.Left = 15;
+chart.PrimaryValueAxis.TitleArea.Layout.Top = 20;
+chart.PrimaryCategoryAxis.TitleArea.Layout.Left = 25;
+chart.PrimaryCategoryAxis.TitleArea.Layout.Top = 20;
+
+//Manually resizing axis title area using Manual Layout
+chart.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Left = 0.04;
+chart.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Top = 0.34;
+chart.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Left = 0.38;
+chart.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Top = 0.95;
+
+//Manually resizing data label area using Layout
+chart.Series[0].DataPoints[0].DataLabels.Layout.Left = 0.09;
+chart.Series[0].DataPoints[0].DataLabels.Layout.Top = 0.01;
+
+//Manually resizing data label area using Manual Layout
+chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Left = 0.09;
+chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Top = 0.01;
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
-//Manually resizing chart plot area
-chart.PlotArea.Layout.Left = 50;
-chart.PlotArea.Layout.Top = 75;
-chart.PlotArea.Layout.Width = 300;
+//Manually resizing chart plot area using Layout
+chart.PlotArea.Layout.Left = 70;
+chart.PlotArea.Layout.Top = 40;
+chart.PlotArea.Layout.Width = 280;
chart.PlotArea.Layout.Height = 200;
-//Manually resizing chart legend
+//Manually resizing chart plot area using Manual Layout
+chart.PlotArea.Layout.ManualLayout.Height = 0.80;
+chart.PlotArea.Layout.ManualLayout.Width = 0.65;
+chart.PlotArea.Layout.ManualLayout.Top = 0.03;
+chart.PlotArea.Layout.ManualLayout.Left = -0.1;
+
+//Manually resizing chart legend area using Layout
chart.Legend.Layout.Left = 400;
chart.Legend.Layout.Top = 150;
chart.Legend.Layout.Width = 150;
chart.Legend.Layout.Height = 100;
+
+//Manually resizing chart legend area using Manual Layout
+chart.Legend.Layout.ManualLayout.Height = 0.09;
+chart.Legend.Layout.ManualLayout.Width = 0.30;
+chart.Legend.Layout.ManualLayout.Top = 0.36;
+chart.Legend.Layout.ManualLayout.Left = 0.68;
+
+//Manually resizing chart title area using Layout
+chart.ChartTitleArea.Text = "Sample Chart";
+chart.ChartTitleArea.Layout.Top = 10;
+chart.ChartTitleArea.Layout.Left = 150;
+
+//Manually resizing chart title area using Manual Layout
+chart.ChartTitleArea.Text = "Sample Chart";
+chart.ChartTitleArea.Layout.ManualLayout.Top = 0.005;
+chart.ChartTitleArea.Layout.ManualLayout.Left = 0.26;
+
+//Manually resizing axis title area using Layout
+chart.PrimaryValueAxis.TitleArea.Layout.Left = 15;
+chart.PrimaryValueAxis.TitleArea.Layout.Top = 20;
+chart.PrimaryCategoryAxis.TitleArea.Layout.Left = 25;
+chart.PrimaryCategoryAxis.TitleArea.Layout.Top = 20;
+
+//Manually resizing axis title area using Manual Layout
+chart.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Left = 0.04;
+chart.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Top = 0.34;
+chart.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Left = 0.38;
+chart.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Top = 0.95;
+
+//Manually resizing data label area using Layout
+chart.Series[0].DataPoints[0].DataLabels.Layout.Left = 0.09;
+chart.Series[0].DataPoints[0].DataLabels.Layout.Top = 0.01;
+
+//Manually resizing data label area using Manual Layout
+chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Left = 0.09;
+chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Top = 0.01;
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
-'Manually resizing chart plot area
-chart.PlotArea.Layout.Left = 50
-chart.PlotArea.Layout.Top = 75
-chart.PlotArea.Layout.Width = 300
+'Manually resizing chart plot area using Layout
+chart.PlotArea.Layout.Left = 70
+chart.PlotArea.Layout.Top = 40
+chart.PlotArea.Layout.Width = 280
chart.PlotArea.Layout.Height = 200
-'Manually resizing chart legend
-chart.Legend.Layout.Left = 400
-chart.Legend.Layout.Top = 150
-chart.Legend.Layout.Width = 150
+'Manually resizing chart plot area using Manual Layout
+chart.PlotArea.Layout.ManualLayout.Height = 0.80
+chart.PlotArea.Layout.ManualLayout.Width = 0.65
+chart.PlotArea.Layout.ManualLayout.Top = 0.03
+chart.PlotArea.Layout.ManualLayout.Left = -0.1
+
+'Manually resizing chart legend area using Layout
+chart.Legend.Layout.Left = 400
+chart.Legend.Layout.Top = 150
+chart.Legend.Layout.Width = 150
chart.Legend.Layout.Height = 100
+
+'Manually resizing chart legend area using Manual Layout
+chart.Legend.Layout.ManualLayout.Height = 0.09
+chart.Legend.Layout.ManualLayout.Width = 0.30
+chart.Legend.Layout.ManualLayout.Top = 0.36
+chart.Legend.Layout.ManualLayout.Left = 0.68
+
+'Manually resizing chart title area using Layout
+chart.ChartTitleArea.Text = "Sample Chart"
+chart.ChartTitleArea.Layout.Top = 10
+chart.ChartTitleArea.Layout.Left = 150
+
+'Manually resizing chart title area using Manual Layout
+chart.ChartTitleArea.Text = "Sample Chart"
+chart.ChartTitleArea.Layout.ManualLayout.Top = 0.005
+chart.ChartTitleArea.Layout.ManualLayout.Left = 0.26
+
+'Manually resizing axis title area using Layout
+chart.PrimaryValueAxis.TitleArea.Layout.Left = 15
+chart.PrimaryValueAxis.TitleArea.Layout.Top = 20
+chart.PrimaryCategoryAxis.TitleArea.Layout.Left = 25
+chart.PrimaryCategoryAxis.TitleArea.Layout.Top = 20
+
+'Manually resizing axis title area using Manual Layout
+chart.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Left = 0.04
+chart.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Top = 0.34
+chart.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Left = 0.38
+chart.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Top = 0.95
+
+'Manually resizing data label area using Layout
+chart.Series(0).DataPoints(0).DataLabels.Layout.Left = 0.09
+chart.Series(0).DataPoints(0).DataLabels.Layout.Top = 0.01
+
+'Manually resizing data label area using Manual Layout
+chart.Series(0).DataPoints(0).DataLabels.Layout.ManualLayout.Left = 0.09
+chart.Series(0).DataPoints(0).DataLabels.Layout.ManualLayout.Top = 0.01
{% endhighlight %}
{% endtabs %}
@@ -2444,17 +2597,17 @@ The following code example explains how to apply transparency to chart area.
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
//Applying transparency to chart area
-chart.ChartArea.Fill.Transparency = 0.9;
+chart.ChartArea.Fill.Transparency = 0.5;
{% endhighlight %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
//Applying transparency to chart area
-chart.ChartArea.Fill.Transparency = 0.9;
+chart.ChartArea.Fill.Transparency = 0.5;
{% endhighlight %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Applying transparency to chart area
-chart.ChartArea.Fill.Transparency = 0.9
+chart.ChartArea.Fill.Transparency = 0.5
{% endhighlight %}
{% endtabs %}
@@ -2465,9 +2618,12 @@ The complete code snippet illustrating the above options is shown below.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
- application.DefaultVersion = ExcelVersion.Excel2013;
+ application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
+
+ //Positioning chart elements using layout
+ //Access the first sheet in the workbook
IWorksheet sheet = workbook.Worksheets[0];
IChartShape chart = sheet.Charts[0];
@@ -2478,12 +2634,12 @@ using (ExcelEngine excelEngine = new ExcelEngine())
chart.RightColumn = 10;
chart.BottomRow = 10;
- //Manually positioning plot area
+ //Manually positioning chart plot area
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.inner;
chart.PlotArea.Layout.LeftMode = LayoutModes.edge;
chart.PlotArea.Layout.TopMode = LayoutModes.edge;
- //Manually positioning chart legend
+ //Manually positioning chart legend area
chart.Legend.Layout.LeftMode = LayoutModes.edge;
chart.Legend.Layout.TopMode = LayoutModes.edge;
IShape chartShape = chart as IShape;
@@ -2495,19 +2651,92 @@ using (ExcelEngine excelEngine = new ExcelEngine())
chartShape.Width = 500;
//Manually resizing chart plot area
- chart.PlotArea.Layout.Left = 50;
- chart.PlotArea.Layout.Top = 75;
- chart.PlotArea.Layout.Width = 300;
+ chart.PlotArea.Layout.Left = 70;
+ chart.PlotArea.Layout.Top = 40;
+ chart.PlotArea.Layout.Width = 280;
chart.PlotArea.Layout.Height = 200;
- //Manually resizing chart legend
+ //Manually resizing chart legend area
chart.Legend.Layout.Left = 400;
chart.Legend.Layout.Top = 150;
- chart.Legend.Layout.Width = 200;
+ chart.Legend.Layout.Width = 150;
chart.Legend.Layout.Height = 100;
+ // Manually resizing chart title area
+ chart.ChartTitleArea.Text = "Sample Chart";
+ chart.ChartTitleArea.Layout.Top = 10;
+ chart.ChartTitleArea.Layout.Left = 150;
+
+ // Manually resizing axis title area
+ chart.PrimaryValueAxis.TitleArea.Layout.Left = 15;
+ chart.PrimaryValueAxis.TitleArea.Layout.Top = 20;
+ chart.PrimaryCategoryAxis.TitleArea.Layout.Left = 25;
+ chart.PrimaryCategoryAxis.TitleArea.Layout.Top = 20;
+
+ // Manually resizing data label area
+ chart.Series[0].DataPoints[0].DataLabels.Layout.Left = 0.09;
+ chart.Series[0].DataPoints[0].DataLabels.Layout.Top = 0.01;
+
//Applying transparency to chart area
- chart.ChartArea.Fill.Transparency = 0.9;
+ chart.ChartArea.Fill.Transparency = 0.5;
+
+ //Positioning chart elements using manual layout
+ //Access the second sheet in the workbook
+ IWorksheet sheet1 = workbook.Worksheets[1];
+
+ IChartShape chart1 = sheet1.Charts[0];
+
+ //Positioning chart in a worksheet
+ chart1.TopRow = 5;
+ chart1.LeftColumn = 5;
+ chart1.RightColumn = 10;
+ chart1.BottomRow = 10;
+
+ //Manually positioning chart plot area
+ chart1.PlotArea.Layout.ManualLayout.LayoutTarget = LayoutTargets.inner;
+ chart1.PlotArea.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+ chart1.PlotArea.Layout.ManualLayout.TopMode = LayoutModes.edge;
+
+ //Manually positioning chart legend area
+ chart1.Legend.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+ chart1.Legend.Layout.ManualLayout.TopMode = LayoutModes.edge;
+ IShape chartShape1 = chart1 as IShape;
+
+ //Set Height of the chart in pixels
+ chartShape1.Height = 300;
+
+ //Set Width of the chart
+ chartShape1.Width = 500;
+
+ //Manually resizing chart plot area
+ chart1.PlotArea.Layout.ManualLayout.Height = 0.80;
+ chart1.PlotArea.Layout.ManualLayout.Width = 0.65;
+ chart1.PlotArea.Layout.ManualLayout.Top = 0.03;
+ chart1.PlotArea.Layout.ManualLayout.Left = -0.1;
+
+ //Manually resizing chart legend area
+ chart1.Legend.Layout.ManualLayout.Height = 0.09;
+ chart1.Legend.Layout.ManualLayout.Width = 0.30;
+ chart1.Legend.Layout.ManualLayout.Top = 0.36;
+ chart1.Legend.Layout.ManualLayout.Left = 0.68;
+
+ //Manually resizing chart title area
+ chart1.ChartTitleArea.Text = "Sample Chart";
+ chart1.ChartTitleArea.Layout.ManualLayout.Top = 0.005;
+ chart1.ChartTitleArea.Layout.ManualLayout.Left = 0.26;
+
+ //Manually resizing axis title area
+ chart1.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Left = 0.04;
+ chart1.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Top = 0.34;
+ chart1.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Left = 0.38;
+ chart1.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Top = 0.95;
+
+ //Manually resizing data label area
+ chart1.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Left = 0.09;
+ chart1.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Top = 0.01;
+
+ //Applying transparency to chart area
+ chart1.ChartArea.Fill.Transparency = 0.5;
//Saving the workbook as stream
FileStream stream = new FileStream("Chart.xlsx", FileMode.Create, FileAccess.ReadWrite);
@@ -2520,9 +2749,13 @@ using (ExcelEngine excelEngine = new ExcelEngine())
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
- application.DefaultVersion = ExcelVersion.Excel2013;
+ application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
+
+ //Positioning chart elements using layout
+ //Access the first sheet in the workbook
IWorksheet sheet = workbook.Worksheets[0];
+
IChartShape chart = sheet.Charts[0];
//Positioning chart in a worksheet
@@ -2531,12 +2764,12 @@ using (ExcelEngine excelEngine = new ExcelEngine())
chart.RightColumn = 10;
chart.BottomRow = 10;
- //Manually positioning plot area
+ //Manually positioning chart plot area
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.inner;
chart.PlotArea.Layout.LeftMode = LayoutModes.edge;
chart.PlotArea.Layout.TopMode = LayoutModes.edge;
- //Manually positioning chart legend
+ //Manually positioning chart legend area
chart.Legend.Layout.LeftMode = LayoutModes.edge;
chart.Legend.Layout.TopMode = LayoutModes.edge;
IShape chartShape = chart as IShape;
@@ -2548,19 +2781,92 @@ using (ExcelEngine excelEngine = new ExcelEngine())
chartShape.Width = 500;
//Manually resizing chart plot area
- chart.PlotArea.Layout.Left = 50;
- chart.PlotArea.Layout.Top = 75;
- chart.PlotArea.Layout.Width = 300;
+ chart.PlotArea.Layout.Left = 70;
+ chart.PlotArea.Layout.Top = 40;
+ chart.PlotArea.Layout.Width = 280;
chart.PlotArea.Layout.Height = 200;
- //Manually resizing chart legend
+ //Manually resizing chart legend area
chart.Legend.Layout.Left = 400;
chart.Legend.Layout.Top = 150;
- chart.Legend.Layout.Width = 200;
+ chart.Legend.Layout.Width = 150;
chart.Legend.Layout.Height = 100;
+ // Manually resizing chart title area
+ chart.ChartTitleArea.Text = "Sample Chart";
+ chart.ChartTitleArea.Layout.Top = 10;
+ chart.ChartTitleArea.Layout.Left = 150;
+
+ // Manually resizing axis title area
+ chart.PrimaryValueAxis.TitleArea.Layout.Left = 15;
+ chart.PrimaryValueAxis.TitleArea.Layout.Top = 20;
+ chart.PrimaryCategoryAxis.TitleArea.Layout.Left = 25;
+ chart.PrimaryCategoryAxis.TitleArea.Layout.Top = 20;
+
+ // Manually resizing data label area
+ chart.Series[0].DataPoints[0].DataLabels.Layout.Left = 0.09;
+ chart.Series[0].DataPoints[0].DataLabels.Layout.Top = 0.01;
+
+ //Applying transparency to chart area
+ chart.ChartArea.Fill.Transparency = 0.5;
+
+ //Positioning chart elements using manual layout
+ //Access the second sheet in the workbook
+ IWorksheet sheet1 = workbook.Worksheets[1];
+
+ IChartShape chart1 = sheet1.Charts[0];
+
+ //Positioning chart in a worksheet
+ chart1.TopRow = 5;
+ chart1.LeftColumn = 5;
+ chart1.RightColumn = 10;
+ chart1.BottomRow = 10;
+
+ //Manually positioning chart plot area
+ chart1.PlotArea.Layout.ManualLayout.LayoutTarget = LayoutTargets.inner;
+ chart1.PlotArea.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+ chart1.PlotArea.Layout.ManualLayout.TopMode = LayoutModes.edge;
+
+ //Manually positioning chart legend area
+ chart1.Legend.Layout.ManualLayout.LeftMode = LayoutModes.edge;
+ chart1.Legend.Layout.ManualLayout.TopMode = LayoutModes.edge;
+ IShape chartShape1 = chart1 as IShape;
+
+ //Set Height of the chart in pixels
+ chartShape1.Height = 300;
+
+ //Set Width of the chart
+ chartShape1.Width = 500;
+
+ //Manually resizing chart plot area
+ chart1.PlotArea.Layout.ManualLayout.Height = 0.80;
+ chart1.PlotArea.Layout.ManualLayout.Width = 0.65;
+ chart1.PlotArea.Layout.ManualLayout.Top = 0.03;
+ chart1.PlotArea.Layout.ManualLayout.Left = -0.1;
+
+ //Manually resizing chart legend area
+ chart1.Legend.Layout.ManualLayout.Height = 0.09;
+ chart1.Legend.Layout.ManualLayout.Width = 0.30;
+ chart1.Legend.Layout.ManualLayout.Top = 0.36;
+ chart1.Legend.Layout.ManualLayout.Left = 0.68;
+
+ //Manually resizing chart title area
+ chart1.ChartTitleArea.Text = "Sample Chart";
+ chart1.ChartTitleArea.Layout.ManualLayout.Top = 0.005;
+ chart1.ChartTitleArea.Layout.ManualLayout.Left = 0.26;
+
+ //Manually resizing axis title area
+ chart1.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Left = 0.04;
+ chart1.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Top = 0.34;
+ chart1.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Left = 0.38;
+ chart1.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Top = 0.95;
+
+ //Manually resizing data label area
+ chart1.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Left = 0.09;
+ chart1.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Top = 0.01;
+
//Applying transparency to chart area
- chart.ChartArea.Fill.Transparency = 0.9;
+ chart1.ChartArea.Fill.Transparency = 0.5;
workbook.SaveAs("Chart.xlsx");
}
@@ -2569,9 +2875,13 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
- application.DefaultVersion = ExcelVersion.Excel2013
+ application.DefaultVersion = ExcelVersion.Xlsx
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
+
+ 'Positioning chart elements using layout
+ 'Access the first sheet in the workbook
Dim sheet As IWorksheet = workbook.Worksheets(0)
+
Dim chart As IChartShape = sheet.Charts(0)
'Positioning chart in a worksheet
@@ -2580,12 +2890,12 @@ Using excelEngine As ExcelEngine = New ExcelEngine()
chart.RightColumn = 10
chart.BottomRow = 10
- 'Manually positioning plot area
+ 'Manually positioning chart plot area
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.inner
chart.PlotArea.Layout.LeftMode = LayoutModes.edge
chart.PlotArea.Layout.TopMode = LayoutModes.edge
- 'Manually positioning chart legend
+ 'Manually positioning chart legend area
chart.Legend.Layout.LeftMode = LayoutModes.edge
chart.Legend.Layout.TopMode = LayoutModes.edge
Dim chartShape As IShape = TryCast(chart, IShape)
@@ -2597,19 +2907,92 @@ Using excelEngine As ExcelEngine = New ExcelEngine()
chartShape.Width = 500
'Manually resizing chart plot area
- chart.PlotArea.Layout.Left = 50
- chart.PlotArea.Layout.Top = 75
- chart.PlotArea.Layout.Width = 300
+ chart.PlotArea.Layout.Left = 70
+ chart.PlotArea.Layout.Top = 40
+ chart.PlotArea.Layout.Width = 280
chart.PlotArea.Layout.Height = 200
- 'Manually resizing chart legend
+ 'Manually resizing chart legend area
chart.Legend.Layout.Left = 400
chart.Legend.Layout.Top = 150
- chart.Legend.Layout.Width = 200
+ chart.Legend.Layout.Width = 150
chart.Legend.Layout.Height = 100
+ 'Manually resizing chart title area
+ chart.ChartTitleArea.Text = "Sample Chart"
+ chart.ChartTitleArea.Layout.Top = 10
+ chart.ChartTitleArea.Layout.Left = 150
+
+ 'Manually resizing axis title area
+ chart.PrimaryValueAxis.TitleArea.Layout.Left = 15
+ chart.PrimaryValueAxis.TitleArea.Layout.Top = 20
+ chart.PrimaryCategoryAxis.TitleArea.Layout.Left = 25
+ chart.PrimaryCategoryAxis.TitleArea.Layout.Top = 20
+
+ 'Manually resizing data label area
+ chart.Series(0).DataPoints(0).DataLabels.Layout.Left = 0.09
+ chart.Series(0).DataPoints(0).DataLabels.Layout.Top = 0.01
+
+ 'Applying transparency to chart area
+ chart.ChartArea.Fill.Transparency = 0.5
+
+ 'Positioning chart elements using manual layout
+ 'Access the second sheet in the workbook
+ Dim sheet1 As IWorksheet = workbook.Worksheets(0)
+
+ Dim chart1 As IChartShape = sheet.Charts(0)
+
+ //Positioning chart in a worksheet
+ chart1.TopRow = 5
+ chart1.LeftColumn = 5
+ chart1.RightColumn = 10
+ chart1.BottomRow = 10
+
+ //Manually positioning chart plot area
+ chart1.PlotArea.Layout.ManualLayout.LayoutTarget = LayoutTargets.inner
+ chart1.PlotArea.Layout.ManualLayout.LeftMode = LayoutModes.edge
+ chart1.PlotArea.Layout.ManualLayout.TopMode = LayoutModes.edge
+
+ //Manually positioning chart legend area
+ chart1.Legend.Layout.ManualLayout.LeftMode = LayoutModes.edge
+ chart1.Legend.Layout.ManualLayout.TopMode = LayoutModes.edge
+ Dim chartShape1 As IShape = TryCast(chart1, IShape)
+
+ //Set Height of the chart in pixels
+ chartShape1.Height = 300
+
+ //Set Width of the chart
+ chartShape1.Width = 500
+
+ //Manually resizing chart plot area
+ chart1.PlotArea.Layout.ManualLayout.Height = 0.80
+ chart1.PlotArea.Layout.ManualLayout.Width = 0.65
+ chart1.PlotArea.Layout.ManualLayout.Top = 0.03
+ chart1.PlotArea.Layout.ManualLayout.Left = -0.1
+
+ //Manually resizing chart legend area
+ chart1.Legend.Layout.ManualLayout.Height = 0.09
+ chart1.Legend.Layout.ManualLayout.Width = 0.30
+ chart1.Legend.Layout.ManualLayout.Top = 0.36
+ chart1.Legend.Layout.ManualLayout.Left = 0.68
+
+ 'Manually resizing chart title area
+ chart1.ChartTitleArea.Text = "Sample Chart"
+ chart1.ChartTitleArea.Layout.ManualLayout.Top = 0.005
+ chart1.ChartTitleArea.Layout.ManualLayout.Left = 0.26
+
+ 'Manually resizing axis title area
+ chart1.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Left = 0.04
+ chart1.PrimaryValueAxis.TitleArea.Layout.ManualLayout.Top = 0.34
+ chart1.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Left = 0.38
+ chart1.PrimaryCategoryAxis.TitleArea.Layout.ManualLayout.Top = 0.95
+
+ 'Manually resizing data label area
+ chart1.Series(0).DataPoints(0).DataLabels.Layout.ManualLayout.Left = 0.09
+ chart1.Series(0).DataPoints(0).DataLabels.Layout.ManualLayout.Top = 0.01
+
'Applying transparency to chart area
- chart.ChartArea.Fill.Transparency = 0.9
+ chart1.ChartArea.Fill.Transparency = 0.5
workbook.SaveAs("Chart.xlsx")
End Using