Exemple #1
0
        protected override void Write(PPTXRenderer renderer, ListBlock listBlock)
        {
            renderer.PushBlockSetting(renderer.Options.List);

            renderer.StartTextArea();

            for (var i = 0; i < listBlock.Count; i++)
            {
                var item     = listBlock[i];
                var listItem = (ListItemBlock)item;

                renderer.AddTextRow(new PPTXText()
                {
                    Bullet = listBlock.IsOrdered ? PPTXBullet.Number : PPTXBullet.Circle
                });

                renderer.WriteChildren(listItem);

                renderer.WriteReturn();
            }

            renderer.EndTextArea();

            renderer.PopBlockSetting();
        }
        protected override void Write(PPTXRenderer renderer, QuoteBlock obj)
        {
            renderer.PushBlockSetting(renderer.Options.QuoteBlock);

            renderer.StartTextArea();

            renderer.WriteChildren(obj);

            renderer.EndTextArea();

            renderer.PopBlockSetting();
        }
Exemple #3
0
        protected override void Write(PPTXRenderer renderer, Table table)
        {
            var tableObj = new PPTXTable();

            foreach (var tableColumnDefinition in table.ColumnDefinitions)
            {
                var pptxTableColObj = new PPTXTableColumn();

                var alignment = tableColumnDefinition.Alignment;
                if (alignment.HasValue)
                {
                    switch (alignment)
                    {
                    case TableColumnAlign.Center:
                        pptxTableColObj.Alignment = PPTXTableColumnAlign.Center;
                        break;

                    case TableColumnAlign.Right:
                        pptxTableColObj.Alignment = PPTXTableColumnAlign.Right;
                        break;

                    case TableColumnAlign.Left:
                        pptxTableColObj.Alignment = PPTXTableColumnAlign.Left;
                        break;
                    }

                    tableObj.Columns.Add(pptxTableColObj);
                }
            }

            renderer.PushBlockSetting(renderer.Options.Table);
            renderer.AddTable(tableObj);

            foreach (var rowObj in table)
            {
                renderer.AddTableRow();

                var row = (TableRow)rowObj;

                for (int i = 0; i < row.Count; i++)
                {
                    renderer.NextTableCell();

                    renderer.WriteChildren((TableCell)row[i]);
                }

                renderer.EndTableRow();
            }

            renderer.PopBlockSetting();
            renderer.AddTableEnd();
        }
Exemple #4
0
        protected override void Write(PPTXRenderer renderer, CodeBlock obj)
        {
            renderer.PushBlockSetting(renderer.Options.Code);

            renderer.Write(" ");
            renderer.WriteReturn();
            renderer.WriteLeafRawLines(obj);
            renderer.WriteReturn();
            renderer.Write(" ");

            renderer.PopBlockSetting();

            renderer.EndTextArea();
        }
Exemple #5
0
        protected override void Write(PPTXRenderer renderer, ParagraphBlock obj)
        {
            if (obj.Parent is MarkdownDocument)
            {
                renderer.PushBlockSetting(renderer.Options.Normal);
            }

            renderer.WriteLeafInline(obj);

            if (obj.Parent is MarkdownDocument)
            {
                renderer.PopBlockSetting();
                renderer.EndTextArea();
            }
        }
Exemple #6
0
        protected override void Write(PPTXRenderer renderer, HeadingBlock obj)
        {
            var _block = renderer.Options.Normal;

            switch (obj.Level)
            {
            case 1:
                _block = renderer.Options.Header1;
                break;

            case 2:
                _block = renderer.Options.Header2;
                break;
            }

            renderer.PushBlockSetting(_block);

            renderer.StartTextArea();

            renderer.WriteLeafInline(obj);
            renderer.PopBlockSetting();

            renderer.EndTextArea();
        }