In DsExcel, you can export charts to PDF documents. This helps in the easy generation of PDF reports from spreadsheets, like finance, sales, marketing, health care etc. Following chart types can be exported to PDF documents:
Refer to the following example code to export charts in Excel files to PDF document.
C# |
Copy Code |
---|---|
// Initialize workbook Workbook workbook = new Workbook(); // Fetch default worksheet IWorksheet worksheet = workbook.Worksheets[0]; IShape shape = worksheet.Shapes.AddChart(ChartType.ColumnStacked, 50, 120, 350, 250); worksheet.Range["A1:D6"].Value = new object[,] { {null, "S1", "S2", "S3"}, {"Item1", 10, 25, 25}, {"Item2", -51, -36, 27}, {"Item3", 52, -85, -30}, {"Item4", 22, 65, 65}, {"Item5", 23, 69, 69} }; shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], RowCol.Columns, true, true); // Saving workbook to pdf workbook.Save(@"ExportChartsToPDF.pdf", SaveFileFormat.Pdf); |
The following chart types are currently not supported and the corresponding area would appear empty when exported to PDF:
The below table shows the supported features in different chart types when exported to PDF.
Common Features (Supported by all Chart Types)
Features |
Settings |
Supported |
Chart Title |
font size |
Yes |
font color |
Yes | |
border |
Yes | |
fill |
Yes | |
overlap with plot area |
No | |
custom angle |
No | |
text direction |
No | |
Plot Area |
border |
Yes |
fill |
Yes | |
free layout(resize) |
Yes | |
Axes |
show/hide |
Yes |
fill |
Yes | |
title |
Yes | |
title free layout |
No | |
border |
Yes | |
angle(text rotate) |
No | |
max/min bounds |
Yes (when min/max is auto, the rendered result might be different between MSExcel and DsExcel) | |
major/minor unit | ||
horizontal axis cross position |
No | |
display units |
Yes | |
logrithimic scale |
Yes | |
values in reverse order |
Yes | |
tick marks |
Yes | |
label position |
Yes | |
number format |
Yes | |
Data Label |
fill |
Yes |
border |
Yes | |
font |
Yes | |
position |
Yes | |
number format |
Yes | |
contains(series name/category name/values) |
Yes | |
Data Table |
No | |
Error Bars |
direction |
Yes (There can be some difference in the exported PDF.) |
end style | ||
error amount | ||
Gridlines |
major/minor |
Yes |
value axis |
Yes | |
category axis |
Yes | |
color |
Yes | |
Legend |
fill |
Yes |
border |
Yes | |
location(top/bottom/left/right) |
Yes | |
free layout(resize) |
Yes | |
Trend Line |
Yes | |
Series Option |
primary axis |
Yes |
secondary axis |
Yes | |
series overlap |
Yes | |
gap width |
Yes | |
fill |
Yes | |
border |
Yes |
Line Chart
Excel Export | PDF Export |
The below table shows the supported features in line chart type when exported to PDF.
Features |
Settings |
Supported |
Line |
solid color |
Yes |
gradient color |
No | |
weight |
Yes | |
cap type |
No | |
join type |
No | |
dash type |
Yes | |
begin arrow |
No | |
end arrow |
No | |
smooth line |
Yes | |
Marker |
size |
Yes |
fill |
Yes | |
border |
Yes | |
Drop Lines |
- |
No |
High-Low Lines |
- |
No |
Up-Down Bars |
- |
No |
Pie Chart
Excel Export | PDF Export |
The below table shows the supported features in pie chart type when exported to PDF.
Features |
Settings |
Supported |
Pie Settings |
angle of first slice |
Yes |
explosion |
No | |
Dought Chart |
doughnut hole size |
Yes |
Bar Chart
Excel Export | PDF Export |
The below table shows the supported features in bar chart type when exported to PDF.
Features |
Settings |
Supported |
Series Option |
overlap |
No |
gap width | Yes |
Scatter Chart
Excel Export | PDF Export |
The below table shows the supported features in scatter chart type when exported to PDF.
Features |
Settings |
Supported |
Chart Type |
scatter |
Yes |
scatter with smooth lines and markers |
Yes | |
scatter with smooth lines |
Yes | |
scatter with straight lines and markers |
Yes | |
scatter with straight lines |
Yes | |
bubble |
Yes | |
3D-bubble |
No | |
Bubble Settings | size represents |
No |
scale bubble size |
No | |
Line | smooth line |
Yes |
Stock Chart
Excel Export | PDF Export |
The below table shows the supported features in stock chart type when exported to PDF.
Features |
Settings |
Supported |
Common Features |
line color |
Yes |
stock |
Yes | |
line dash type |
No | |
line cap |
No | |
line join |
No | |
series marker |
No | |
series line |
No | |
Open-High-Low-Close |
gap width |
No |
down-bar fill |
Yes | |
down-bar border |
No | |
up-bar |
No | |
Volume-High-Low-Close / Volume-Open-High-Low-Close |
volumn fill |
Yes |
volume border |
No |
Radar Chart
Excel Export | PDF Export |
The below table shows the supported features in radar chart type when exported to PDF.
Features |
Settings |
Supported |
Line | cap type | No |
join type | No | |
Chart Type |
radar |
Yes |
radar with markers |
Yes | |
filled radar |
Yes | |
Series Line |
width |
Yes |
color |
Yes | |
Marker |
type |
Yes |
size |
Yes | |
fill |
Yes | |
border |
Yes |
TreeMap Chart
Excel Export | PDF Export |
The below table shows the supported features in TreeMap chart type when exported to PDF.
Features |
Setttings |
Supported |
Series Option |
banner |
No |
overlapping |
No | |
Label Option |
contains(series name/category name/value) |
No |
number fromat |
No | |
text font |
Yes | |
text color |
Yes | |
Point Formatting |
fill |
Yes (Only supports first level points.) |
line |
No |
Sunburst Chart
Excel Export | PDF Export |
The below table shows the supported features in Sunburst chart type when exported to PDF.
Features |
Settings |
Supported |
Plot Area |
fill |
No |
Label Option |
contains(series name/category name/value) |
No |
number fromat |
No | |
text font |
Yes | |
text color |
Yes | |
Point Formatting |
fill |
Yes (Only supports first level points.) |
line |
Yes |