c# - 对齐单元格,使文本在底部对齐

标签 c# pdfsharp migradoc

我想将 TableCell 中的文本对齐到单元格的底部。我在表格单元属性的任何地方都没有看到这个选项。这是构建该表的代码片段。

        Table thirdTable = section.Headers.Primary.AddTable();

        thirdTable.Format.Font.Size = "7pt";

        column = thirdTable.AddColumn("1.5cm");
        column.Format.Alignment = ParagraphAlignment.Center;

        column = thirdTable.AddColumn("1cm");
        column.Format.Alignment = ParagraphAlignment.Center;

        column = thirdTable.AddColumn("7cm");
        column.Format.Alignment = ParagraphAlignment.Left;

        column = thirdTable.AddColumn("2.5cm");
        column.Format.Alignment = ParagraphAlignment.Center;

        column = thirdTable.AddColumn("1cm");
        column.Format.Alignment = ParagraphAlignment.Center;

        column = thirdTable.AddColumn("1.5cm");
        column.Format.Alignment = ParagraphAlignment.Center;

        column = thirdTable.AddColumn("1.5cm");
        column.Format.Alignment = ParagraphAlignment.Center;

        row = thirdTable.AddRow();
        row = thirdTable.AddRow();

        row.Cells[0].AddParagraph("Segment Code");
        row.Cells[1].AddParagraph("Milepoint");
        row.Cells[2].AddParagraph("Description of Milepoint");
        row.Cells[3].AddParagraph("City Name");
        row.Cells[4].AddParagraph("Segment Code");
        row.Cells[5].AddParagraph("Milepoint");
        row.Cells[6].AddParagraph("FA Route Number");

最佳答案

好吧,我终于找到了它,它一直在我面前。我只是错过了。

在本示例文档 http://www.pdfsharp.net/wiki/Invoice-sample.ashx 中进行了介绍.

这就是我的代码现在的样子

        row.Cells[0].AddParagraph("Segment Code");
        row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[1].AddParagraph("Milepoint");
        row.Cells[1].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[2].AddParagraph("Description of Milepoint");
        row.Cells[2].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[3].AddParagraph("City Name");
        row.Cells[3].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[4].AddParagraph("Segment Code");
        row.Cells[4].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[5].AddParagraph("Milepoint");
        row.Cells[5].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[6].AddParagraph("FA Route Number");
        row.Cells[6].VerticalAlignment = VerticalAlignment.Bottom;

关于c# - 对齐单元格,使文本在底部对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32976408/

相关文章:

c# - 如何使用 PdfSharp 将 .SVG 写入 pdf

c# - 省略号或用 PDFsharp 换行

c# - PDFsharp 在 Azure 中生成空白页面,但在本地工作

c# - WCF——两种方法之间的通信

c# - 为什么可选参数必须出现在声明的末尾

c# - C#是高级语言吗?

c# - 为什么 PdfSharp 在网络链接周围创建边框?

bookmarks - pdfsharp没有相关书签的段落

pdfsharp - 使用 PDFSharp 旋转表格单元格内的文本

c# - 无法隐式转换类型 System.Collections.Generic.Dictionary<System.Tuple<int,int,string>, AnonymousType#1>