diff --git a/Examples/ApiExamples/ApiExamples/ExCharts.cs b/Examples/ApiExamples/ApiExamples/ExCharts.cs index 50ad4b42..39039473 100644 --- a/Examples/ApiExamples/ApiExamples/ExCharts.cs +++ b/Examples/ApiExamples/ApiExamples/ExCharts.cs @@ -2243,5 +2243,60 @@ public void TickLabelsOrientationRotation() doc.Save(ArtifactsDir + "Charts.TickLabelsOrientationRotation.docx"); //ExEnd:TickLabelsOrientationRotation } + + [Test] + public void DoughnutChart() + { + //ExStart:DoughnutChart + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:ChartSeriesGroup.DoughnutHoleSize + //ExFor:ChartSeriesGroup.FirstSliceAngle + //ExSummary:Shows how to create and format Doughnut chart. + Document doc = new Document(); + DocumentBuilder builder = new DocumentBuilder(doc); + + Shape shape = builder.InsertChart(ChartType.Doughnut, 400, 400); + Chart chart = shape.Chart; + // Delete the default generated series. + chart.Series.Clear(); + + string[] categories = new string[] { "Category 1", "Category 2", "Category 3" }; + chart.Series.Add("Series 1", categories, new double[] { 4, 2, 5 }); + + // Format the Doughnut chart. + ChartSeriesGroup seriesGroup = chart.SeriesGroups[0]; + seriesGroup.DoughnutHoleSize = 10; + seriesGroup.FirstSliceAngle = 270; + + doc.Save(ArtifactsDir + "Charts.DoughnutChart.docx"); + //ExEnd:DoughnutChart + } + + [Test] + public void PieOfPieChart() + { + //ExStart:PieOfPieChart + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:ChartSeriesGroup.SecondSectionSize + //ExSummary:Shows how to create and format pie of Pie chart. + Document doc = new Document(); + DocumentBuilder builder = new DocumentBuilder(doc); + + Shape shape = builder.InsertChart(ChartType.PieOfPie, 440, 300); + Chart chart = shape.Chart; + // Delete the default generated series. + chart.Series.Clear(); + + string[] categories = new string[] { "Category 1", "Category 2", "Category 3", "Category 4" }; + chart.Series.Add("Series 1", categories, new double[] { 11, 8, 4, 3 }); + + // Format the Pie of Pie chart. + ChartSeriesGroup seriesGroup = chart.SeriesGroups[0]; + seriesGroup.GapWidth = 10; + seriesGroup.SecondSectionSize = 77; + + doc.Save(ArtifactsDir + "Charts.PieOfPieChart.docx"); + //ExEnd:PieOfPieChart + } } } diff --git a/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs b/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs index c901545a..960fdd41 100644 --- a/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs +++ b/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs @@ -245,6 +245,42 @@ public void LinkExportMode() string outDocContents = File.ReadAllText(ArtifactsDir + "MarkdownSaveOptions.LinkExportMode.Inline.md"); Assert.AreEqual("![](MarkdownSaveOptions.LinkExportMode.Inline.001.png)", outDocContents.Trim()); } + + [Test] + public void ExportTableAsHtml() + { + //ExStart:ExportTableAsHtml + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:MarkdownExportAsHtml + //ExFor:MarkdownSaveOptions.ExportAsHtml + //ExSummary:Shows how to export a table to Markdown as raw HTML. + Document doc = new Document(); + DocumentBuilder builder = new DocumentBuilder(doc); + + builder.Writeln("Sample table:"); + + // Create table. + builder.InsertCell(); + builder.ParagraphFormat.Alignment = ParagraphAlignment.Right; + builder.Write("Cell1"); + builder.InsertCell(); + builder.ParagraphFormat.Alignment = ParagraphAlignment.Center; + builder.Write("Cell2"); + + MarkdownSaveOptions saveOptions = new MarkdownSaveOptions(); + saveOptions.ExportAsHtml = MarkdownExportAsHtml.Tables; + + doc.Save(ArtifactsDir + "MarkdownSaveOptions.ExportTableAsHtml.md", saveOptions); + //ExEnd:ExportTableAsHtml + + string outDocContents = File.ReadAllText(ArtifactsDir + "MarkdownSaveOptions.ExportTableAsHtml.md"); + Assert.AreEqual("Sample table:\r\n" + + "
" + + "

Cell1

" + + "
" + + "

Cell2

" + + "
", outDocContents.Trim()); + } } } diff --git a/Examples/ApiExamples/ApiExamples/ExPdfSaveOptions.cs b/Examples/ApiExamples/ApiExamples/ExPdfSaveOptions.cs index 2ee9394b..3f507267 100644 --- a/Examples/ApiExamples/ApiExamples/ExPdfSaveOptions.cs +++ b/Examples/ApiExamples/ApiExamples/ExPdfSaveOptions.cs @@ -547,7 +547,7 @@ public void UsePdfDocumentForCompliance(PdfCompliance pdfCompliance) Assert.AreEqual("2.0", pdfDocument.Version); break; case PdfCompliance.PdfA4: - Assert.AreEqual(PdfFormat.v_2_0, pdfDocument.PdfFormat); + Assert.AreEqual(PdfFormat.PDF_A_4, pdfDocument.PdfFormat); Assert.AreEqual("2.0", pdfDocument.Version); break; case PdfCompliance.PdfA4Ua2: diff --git a/Examples/ApiExamples/ApiExamples/ExShape.cs b/Examples/ApiExamples/ApiExamples/ExShape.cs index 3a522742..12e36cfc 100644 --- a/Examples/ApiExamples/ApiExamples/ExShape.cs +++ b/Examples/ApiExamples/ApiExamples/ExShape.cs @@ -3400,5 +3400,69 @@ public void InsertGroupShape() doc.Save(ArtifactsDir + "Shape.InsertGroupShape.docx"); //ExEnd:InsertGroupShape } + + [Test] + public void CombineGroupShape() + { + //ExStart:CombineGroupShape + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:DocumentBuilder.InsertGroupShape(Shape[]) + //ExSummary:Shows how to combine group shape with the shape. + Document doc = new Document(); + DocumentBuilder builder = new DocumentBuilder(doc); + + Shape shape1 = builder.InsertShape(ShapeType.Rectangle, 200, 250); + shape1.Left = 20; + shape1.Top = 20; + shape1.Stroke.Color = Color.Red; + + Shape shape2 = builder.InsertShape(ShapeType.Ellipse, 150, 200); + shape2.Left = 40; + shape2.Top = 50; + shape2.Stroke.Color = Color.Green; + + // Combine shapes into a GroupShape node which is inserted into the specified position. + GroupShape groupShape1 = builder.InsertGroupShape(shape1, shape2); + + // Combine Shape and GroupShape nodes. + Shape shape3 = (Shape)shape1.Clone(true); + GroupShape groupShape2 = builder.InsertGroupShape(groupShape1, shape3); + + doc.Save(ArtifactsDir + "Shape.CombineGroupShape.docx"); + //ExEnd:CombineGroupShape + } + + [Test] + public void InsertCommandButton() + { + //ExStart:InsertCommandButton + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:CommandButtonControl + //ExFor:DocumentBuilder.InsertForms2OleControl(Forms2OleControl) + //ExSummary:Shows how to insert ActiveX control. + DocumentBuilder builder = new DocumentBuilder(); + + CommandButtonControl button1 = new CommandButtonControl(); + Shape shape = builder.InsertForms2OleControl(button1); + Assert.AreEqual(Forms2OleControlType.CommandButton, ((Forms2OleControl)shape.OleFormat.OleControl).Type); + //ExEnd:InsertCommandButton + } + + [Test] + public void Hidden() + { + //ExStart:Hidden + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:ShapeBase.Hidden + //ExSummary:Shows how to hide the shape. + Document doc = new Document(MyDir + "Shadow color.docx"); + + Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true); + if (!shape.Hidden) + shape.Hidden = true; + + doc.Save(ArtifactsDir + "Shape.Hidden.docx"); + //ExEnd:Hidden + } } }