예제 #1
0
        private void ProcessTableBorder(DocxNode node, DocxTableProperties docxProperties, TableProperties tableProperties)
        {
            string borderStyle = node.ExtractAttributeValue(DocxBorder.borderName);

            if (borderStyle == "1")
            {
                TableBorders tableBorders = new TableBorders();
                DocxBorder.ApplyDefaultBorders(tableBorders);
                tableProperties.Append(tableBorders);
            }
            else
            {
                borderStyle = node.ExtractStyleValue(DocxBorder.borderName);
                string leftBorder   = node.ExtractStyleValue(DocxBorder.leftBorderName);
                string topBorder    = node.ExtractStyleValue(DocxBorder.topBorderName);
                string rightBorder  = node.ExtractStyleValue(DocxBorder.rightBorderName);
                string bottomBorder = node.ExtractStyleValue(DocxBorder.bottomBorderName);

                TableBorders tableBorders = new TableBorders();

                DocxBorder.ApplyBorders(tableBorders, borderStyle, leftBorder, topBorder,
                                        rightBorder, bottomBorder, docxProperties.HasDefaultBorder);

                if (tableBorders.HasChildren)
                {
                    tableProperties.Append(tableBorders);
                }
            }
        }
예제 #2
0
        internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties)
        {
            if (node.IsNull() || node.Parent == null || IsHidden(node))
            {
                return;
            }

            paragraph = null;

            Paragraph hrParagraph = node.Parent.AppendChild(new Paragraph());

            OnParagraphCreated(node, hrParagraph);

            if (hrParagraph.ParagraphProperties == null)
            {
                hrParagraph.ParagraphProperties = new ParagraphProperties();
            }

            ParagraphBorders paragraphBorders = new ParagraphBorders();

            DocxBorder.ApplyDefaultBorder <TopBorder>(paragraphBorders);
            hrParagraph.ParagraphProperties.Append(paragraphBorders);

            Run run = hrParagraph.AppendChild(new Run(new Text()));

            RunCreated(node, run);
        }
        private void ProcessBorder(DocxNode node, ParagraphProperties properties)
        {
            ParagraphBorders paragraphBorders = new ParagraphBorders();

            DocxBorder.ApplyBorders(paragraphBorders,
                                    node.ExtractStyleValue(DocxBorder.borderName),
                                    node.ExtractStyleValue(DocxBorder.leftBorderName),
                                    node.ExtractStyleValue(DocxBorder.topBorderName),
                                    node.ExtractStyleValue(DocxBorder.rightBorderName),
                                    node.ExtractStyleValue(DocxBorder.bottomBorderName),
                                    false);

            if (paragraphBorders.HasChildren)
            {
                properties.Append(paragraphBorders);
            }
        }
        private void ProcessBorders(DocxNode node, DocxTableProperties docxProperties,
                                    TableCellProperties cellProperties)
        {
            string borderStyle  = node.ExtractStyleValue(DocxBorder.borderName);
            string leftBorder   = node.ExtractStyleValue(DocxBorder.leftBorderName);
            string topBorder    = node.ExtractStyleValue(DocxBorder.topBorderName);
            string rightBorder  = node.ExtractStyleValue(DocxBorder.rightBorderName);
            string bottomBorder = node.ExtractStyleValue(DocxBorder.bottomBorderName);

            TableCellBorders cellBorders = new TableCellBorders();

            DocxBorder.ApplyBorders(cellBorders, borderStyle, leftBorder, topBorder,
                                    rightBorder, bottomBorder, docxProperties.HasDefaultBorder);

            if (cellBorders.HasChildren)
            {
                cellProperties.Append(cellBorders);
            }
        }