Skip to content

Commit

Permalink
Updated xlsx plugin example
Browse files Browse the repository at this point in the history
  • Loading branch information
falleretic committed Oct 31, 2023
1 parent 5ae8fd6 commit 9d035c8
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions Examples/DocsExamples/PluginsExamples/ProcessorXlsxFilesPlugin.cs
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
}
}
}

0 comments on commit 9d035c8

Please sign in to comment.