//private void AddContent(ShapeTree shapeTree1, uint ObjectID, PPTXTextArea Content, PlaceholderValues PlaceHolderType, uint PlaceHolderIndex = uint.MaxValue) //{ // Shape shape1 = new Shape(); // NonVisualShapeProperties nonVisualShapeProperties1 = new NonVisualShapeProperties(); // NonVisualDrawingProperties nonVisualDrawingProperties2 = new NonVisualDrawingProperties() { Id = ObjectID, Name = $"Content{ObjectID}" }; // NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties1 = new NonVisualShapeDrawingProperties() { TextBox = true}; // A.ShapeLocks shapeLocks1 = new A.ShapeLocks() { NoGrouping = true }; // nonVisualShapeDrawingProperties1.Append(shapeLocks1); // ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties2 = new ApplicationNonVisualDrawingProperties(); // PlaceholderShape placeholderShape1 = new PlaceholderShape();// { Type = PlaceHolderType }; // if (PlaceHolderIndex != uint.MaxValue) // { // placeholderShape1.Index = PlaceHolderIndex; // } // applicationNonVisualDrawingProperties2.Append(placeholderShape1); // nonVisualShapeProperties1.Append(nonVisualDrawingProperties2); // nonVisualShapeProperties1.Append(nonVisualShapeDrawingProperties1); // nonVisualShapeProperties1.Append(applicationNonVisualDrawingProperties2); // ShapeProperties shapeProperties1 = new ShapeProperties(); // A.SolidFill solidFill1 = new A.SolidFill(); // A.SchemeColor schemeColor1 = new A.SchemeColor() { Val = A.SchemeColorValues.Accent1 }; // A.LuminanceModulation luminanceModulation1 = new A.LuminanceModulation() { Val = 20000 }; // A.LuminanceOffset luminanceOffset1 = new A.LuminanceOffset() { Val = 80000 }; // schemeColor1.Append(luminanceModulation1); // schemeColor1.Append(luminanceOffset1); // solidFill1.Append(schemeColor1); // shapeProperties1.Append(solidFill1); // TextBody textBody1 = new TextBody(); // A.BodyProperties bodyProperties1 = new A.BodyProperties(); // A.ListStyle listStyle1 = new A.ListStyle(); // textBody1.Append(bodyProperties1); // textBody1.Append(listStyle1); // A.Transform2D transform2D25 = SlideWriterHelper.CreateTransform2D(Content.Transform); // if (transform2D25 != null) // { // shapeProperties1.Append(transform2D25); // } // shape1.Append(nonVisualShapeProperties1); // shape1.Append(shapeProperties1); // shape1.Append(textBody1); // foreach (var _textLine in Content.Texts) // { // var paragraph = new A.Paragraph(SlideWriterHelper.CrateParagraphProperties(_textLine)); // foreach(var _textRun in _textLine.Texts) // { // paragraph.Append(new A.Run() // { // RunProperties = SlideWriterHelper.CreateRunProperties(_textRun, HyperLinkIDMap), // Text = new A.Text(_textRun.Text) // }); // } // shape1.TextBody.Append(paragraph); // } // shapeTree1.Append(shape1); //} private void AddTextBox(ShapeTree shapeTree1, uint ObjectID, PPTXTextArea Content) { Shape shape1 = new Shape(); NonVisualShapeProperties nonVisualShapeProperties1 = new NonVisualShapeProperties(); NonVisualDrawingProperties nonVisualDrawingProperties2 = new NonVisualDrawingProperties() { Id = ObjectID, Name = $"Content{ObjectID}" }; A.NonVisualDrawingPropertiesExtensionList nonVisualDrawingPropertiesExtensionList1 = new A.NonVisualDrawingPropertiesExtensionList(); A.NonVisualDrawingPropertiesExtension nonVisualDrawingPropertiesExtension1 = new A.NonVisualDrawingPropertiesExtension() { Uri = "{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}" }; OpenXmlUnknownElement openXmlUnknownElement1 = OpenXmlUnknownElement.CreateOpenXmlUnknownElement("<a16:creationId xmlns:a16=\"http://schemas.microsoft.com/office/drawing/2014/main\" id=\"{5FE2CA47-E73A-450F-9AE0-DF438874E2FB}\" />"); nonVisualDrawingPropertiesExtension1.Append(openXmlUnknownElement1); nonVisualDrawingPropertiesExtensionList1.Append(nonVisualDrawingPropertiesExtension1); nonVisualDrawingProperties2.Append(nonVisualDrawingPropertiesExtensionList1); NonVisualShapeDrawingProperties nonVisualShapeDrawingProperties1 = new NonVisualShapeDrawingProperties() { TextBox = true }; ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties2 = new ApplicationNonVisualDrawingProperties(); nonVisualShapeProperties1.Append(nonVisualDrawingProperties2); nonVisualShapeProperties1.Append(nonVisualShapeDrawingProperties1); nonVisualShapeProperties1.Append(applicationNonVisualDrawingProperties2); ShapeProperties shapeProperties1 = new ShapeProperties(); A.PresetGeometry presetGeometry1 = new A.PresetGeometry() { Preset = A.ShapeTypeValues.Rectangle }; A.AdjustValueList adjustValueList1 = new A.AdjustValueList(); presetGeometry1.Append(adjustValueList1); TextBody textBody1 = new TextBody(); A.BodyProperties bodyProperties1 = new A.BodyProperties(); A.ListStyle listStyle1 = new A.ListStyle(); textBody1.Append(bodyProperties1); textBody1.Append(listStyle1); A.Transform2D transform2D25 = SlideWriterHelper.CreateTransform2D(Content.Transform); if (transform2D25 != null) { shapeProperties1.Append(transform2D25); } shapeProperties1.Append(presetGeometry1); if (Content.BackgroundColor.IsTransparent == false) { A.SolidFill solidFill1 = new A.SolidFill(); solidFill1.Append(SlideWriterHelper.CreateRGBColorModeHex(Content.BackgroundColor)); shapeProperties1.Append(solidFill1); } shape1.Append(nonVisualShapeProperties1); shape1.Append(shapeProperties1); shape1.Append(textBody1); foreach (var _textLine in Content.Texts) { var paragraph = new A.Paragraph(SlideWriterHelper.CrateParagraphProperties(_textLine)); foreach (var _textRun in _textLine.Texts) { paragraph.Append(new A.Run() { RunProperties = SlideWriterHelper.CreateRunProperties(_textRun, HyperLinkIDMap), Text = new A.Text(_textRun.Text) }); } shape1.TextBody.Append(paragraph); } shapeTree1.Append(shape1); }
private A.TableRow CreateRow(List <PPTXTableColumn> Cols, PPTXTableRow Row, Dictionary <string, string> HyperLinkIDMap) { A.TableRow tableRow1 = new A.TableRow() { Height = (Int64)(Row.Height * 100) }; foreach (var Cell in Cols.Select((Col, ColIndex) => new { Col = Col, ColIndex = ColIndex })) { A.TableCell tableCell1 = new A.TableCell(); A.TextBody textBody1 = new A.TextBody(); A.BodyProperties bodyProperties1 = new A.BodyProperties(); A.ListStyle listStyle1 = new A.ListStyle(); textBody1.Append(bodyProperties1); textBody1.Append(listStyle1); var _texts = Row.Cells[Cell.ColIndex].Texts.Texts; if (_texts.Count == 0) { _texts.Add(new PPTXTextRun()); } foreach (var _textLine in _texts) { var paragraph = new A.Paragraph(); var cellAlign = A.TextAlignmentTypeValues.Center; switch (Cell.Col.Alignment) { case PPTXTableColumnAlign.Left: cellAlign = A.TextAlignmentTypeValues.Left; break; case PPTXTableColumnAlign.Right: cellAlign = A.TextAlignmentTypeValues.Right; break; } paragraph.Append(new A.ParagraphProperties() { Alignment = cellAlign }); paragraph.Append(new A.Run() { RunProperties = SlideWriterHelper.CreateRunProperties(_textLine, HyperLinkIDMap), Text = new A.Text(_textLine.Text) }); textBody1.Append(paragraph); } A.TableCellProperties tableCellProperties1 = new A.TableCellProperties(); tableCell1.Append(textBody1); tableCell1.Append(tableCellProperties1); tableRow1.Append(tableCell1); } A.ExtensionList extensionList4 = new A.ExtensionList(); tableRow1.Append(extensionList4); return(tableRow1); }