-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ae8fd6
commit 9d035c8
Showing
1 changed file
with
30 additions
and
11 deletions.
There are no files selected for viewing
41 changes: 30 additions & 11 deletions
41
Examples/DocsExamples/PluginsExamples/ProcessorXlsxFilesPlugin.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,49 @@ | ||
using Aspose.Words.Drawing.Charts; | ||
using Aspose.Words; | ||
using NUnit.Framework; | ||
using Aspose.Words.Tables; | ||
using System.Drawing; | ||
|
||
namespace PluginsExamples | ||
{ | ||
public class ProcessorXlsxFilesPlugin : PluginsExamplesBase | ||
{ | ||
[Test] | ||
public void CreateChartXlsxFiles() | ||
public void CreateTableXlsxFiles() | ||
{ | ||
//ExStart:CreateChartXlsxFiles | ||
//ExStart:CreateTableXlsxFiles | ||
//GistId:e57f464b45000561f7792eef06161c11 | ||
var doc = new Document(); | ||
var builder = new DocumentBuilder(doc); | ||
|
||
builder.StartTable(); | ||
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center; | ||
builder.CellFormat.Shading.BackgroundPatternColor = Color.AliceBlue; | ||
|
||
var shape = builder.InsertChart(ChartType.Pie, 432, 252); | ||
var chart = shape.Chart; | ||
chart.Title.Text = "Produced by Aspose.Words Processor plugin."; | ||
for (int i = 0; i < 3; i++) | ||
{ | ||
builder.InsertCell(); | ||
builder.Write($"Row {i + 1}, Column 1"); | ||
builder.InsertCell(); | ||
builder.Write($"Row {i + 1}, Column 2"); | ||
|
||
chart.Series.Clear(); | ||
chart.Series.Add("Series 1", | ||
new string[] { "Category 1", "Category 2", "Category 3" }, | ||
new double[] { 2.7, 3.2, 0.8 }); | ||
Row row = builder.EndRow(); | ||
|
||
doc.Save(ArtifactsDir + "ProcessorXlsxFilesPlugin.CreateChartXlsxFiles.xlsx"); | ||
//ExEnd:CreateChartXlsxFiles | ||
builder.CellFormat.Shading.ClearFormatting(); | ||
|
||
BorderCollection borders = row.RowFormat.Borders; | ||
// Adjust the appearance of borders that will appear between rows. | ||
borders.Horizontal.Color = Color.Red; | ||
borders.Horizontal.LineStyle = LineStyle.Dot; | ||
borders.Horizontal.LineWidth = 2.0d; | ||
// Adjust the appearance of borders that will appear between cells. | ||
borders.Vertical.Color = Color.Blue; | ||
borders.Vertical.LineStyle = LineStyle.Dot; | ||
borders.Vertical.LineWidth = 2.0d; | ||
} | ||
|
||
doc.Save(ArtifactsDir + "ProcessorXlsxFilesPlugin.CreateTableXlsxFiles.xlsx"); | ||
//ExEnd:CreateTableXlsxFiles | ||
} | ||
} | ||
} |