Aspose.Words 表格添加斜线 并添加文字

           Run run = new Run(doc, "text1");
            run.Font.Bold = true;
            run.Font.Size = 8;
            run.Font.Name = "微软雅黑";
            Run run2 = new Run(doc, "text2");
            run2.Font.Bold = true;
            run2.Font.Size = 8;
            run2.Font.Name = "微软雅黑";
          //添加斜线
            Border diagonalBorder = tabledata.FirstRow.FirstCell.CellFormat.Borders[BorderType.DiagonalDown];
            diagonalBorder.Color = Color.Black;
            diagonalBorder.LineStyle = LineStyle.Single;
            diagonalBorder.LineWidth = 1;
            //添加段落 就像添加两个div一样 一个在上面居右 一个在下面居左  中间带斜杠 完美实现
            Paragraph pp = new Paragraph(doc);
            pp.ParagraphFormat.Alignment = ParagraphAlignment.Left;
            pp.AppendChild(run);
            tabledata.FirstRow.FirstCell.AppendChild(pp);
            tabledata.FirstRow.FirstCell.FirstParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Right;
            tabledata.FirstRow.FirstCell.FirstParagraph.AppendChild(run2);

你可能感兴趣的:(aspose,aspose.table,添加斜杠)