Пример #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);
                }
            }
        }
        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);
            }
        }