Пример #1
0
        /// <summary>
        /// Add right border to cell
        /// </summary>
        /// <param name="type">Border Style</param>
        /// <param name="size">Border Width</param>
        /// <param name="space"></param>
        /// <param name="rgbColor">Border Color</param>
        public void SetBorderRight(XWPFTable.XWPFBorderType type, int size, int space, String rgbColor)
        {
            CT_TcPr      ctTcPr  = GetCTTc().IsSetTcPr() ? GetCTTc().tcPr : GetCTTc().AddNewTcPr();
            CT_TcBorders borders = ctTcPr.tcBorders == null?ctTcPr.AddNewTcBorders() : ctTcPr.tcBorders;

            borders.right = CreateBorder(type, size, space, rgbColor);
        }
Пример #2
0
        private static void CopyBorders(CT_TcBorders templateBorders, CT_TcBorders borders)
        {
            if (templateBorders.bottom != null)
            {
                borders.bottom = new CT_Border();
                WordGenerator.CopyBorder(templateBorders.bottom, borders.bottom);
            }

            if (templateBorders.left != null)
            {
                borders.bottom = new CT_Border();
                WordGenerator.CopyBorder(templateBorders.left, borders.left);
            }

            if (templateBorders.right != null)
            {
                borders.bottom = new CT_Border();
                WordGenerator.CopyBorder(templateBorders.right, borders.right);
            }

            if (templateBorders.top != null)
            {
                borders.bottom = new CT_Border();
                WordGenerator.CopyBorder(templateBorders.top, borders.top);
            }
        }
Пример #3
0
        public void Test54099()
        {
            XWPFDocument  doc     = new XWPFDocument();
            CT_Tbl        ctTable = new CT_Tbl();
            XWPFTable     table   = new XWPFTable(ctTable, doc);
            XWPFTableRow  tr      = table.GetRow(0);
            XWPFTableCell cell    = tr.GetCell(0);

            CT_Tc     ctTc   = cell.GetCTTc();
            CT_TcPr   tcPr   = ctTc.AddNewTcPr();
            CT_HMerge hMerge = tcPr.AddNewHMerge();

            hMerge.val = (ST_Merge.restart);

            CT_TcBorders tblBorders = tcPr.AddNewTcBorders();
            CT_VMerge    vMerge     = tcPr.AddNewVMerge();
        }
Пример #4
0
        public void SetBorderBottom(XWPFTable.XWPFBorderType type, int size, int space, String rgbColor)
        {
            CT_TcPr ctTcPr = null;

            if (!GetCTTc().IsSetTcPr())
            {
                ctTcPr = GetCTTc().AddNewTcPr();
            }
            CT_TcBorders borders = ctTcPr.AddNewTcBorders();

            borders.bottom = new CT_Border();
            CT_Border b = borders.bottom;

            b.val   = XWPFTable.xwpfBorderTypeMap[type];
            b.sz    = (ulong)size;
            b.space = (ulong)space;
            b.color = (rgbColor);
        }
Пример #5
0
        private static void CopyCell(XWPFTableCell templateCell, XWPFTableCell cell)
        {
            cell.SetColor(templateCell.GetColor());

            CT_TcBorders templateBorders = templateCell.GetCTTc().tcPr.tcBorders;

            if (templateBorders != null)
            {
                CT_TcBorders borders = cell.GetCTTc().AddNewTcPr().AddNewTcBorders();
                WordGenerator.CopyBorders(templateBorders, borders);
            }

            for (int i = 0; i < cell.Paragraphs.Count; i++)
            {
                cell.RemoveParagraph(0);
            }

            foreach (XWPFParagraph templateph in templateCell.Paragraphs)
            {
                XWPFParagraph ph = cell.AddParagraph();
                WordGenerator.CopyParagraph(templateph, ph);
            }
        }