如何在同一高度的textFrame中获取两个表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在同一高度的textFrame中获取两个表相关的知识,希望对你有一定的参考价值。
我被告知在textFrame内创建了两个表,因为这可能是使两个表在相同高度彼此交叉的最佳方法。当我填写右侧表格的数据和标题时,它不会延伸到与左侧表格相同高度的底部。即使当我添加更多的AddParagraphs()时,右表大麦的底部也超过了左表的底部边框,因此使表的高度不均匀。是否有解决方法或其他方式?我希望右表上显示“ ADV完整性”的位置与表的左侧均匀延伸。
我的代码:
//textFrame for Invoice info
TextFrame billFrame = section.AddTextFrame();
billFrame.Height = "5.0cm";
billFrame.Width = "6.0cm";
billFrame.RelativeHorizontal = RelativeHorizontal.Margin;
billFrame.Top = "7.5cm";
billFrame.MarginRight = "10.0cm";
billFrame.RelativeVertical = RelativeVertical.Page;
billFrame.Left = ShapePosition.Left;
//putting table into the Invoice textFrame
Table table = billFrame.AddTable();
table.Borders.Width = 0.75;
Column column = table.AddColumn(Unit.FromCentimeter(7));
column.Format.Alignment = ParagraphAlignment.Left;
//define headers of "Bill To" table
Row row = table.AddRow();
row.HeadingFormat = true;
Cell cell = row.Cells[0];
row.Shading.Color = Colors.LightGray;
cell.AddParagraph("Bill To:");
cell.Format.Font.Bold = true;
//showing data inside Bill table
row = table.AddRow();
cell = row.Cells[0];
cell.AddParagraph("ADV Integrity");
cell.AddParagraph("Attn: Wendy Courtright");
cell.AddParagraph("P.O. Box 1449");
cell.AddParagraph("Waller, TX 77484");
cell.AddParagraph("United States");
//textFrame for Invoice info
TextFrame invoiceFrame = section.AddTextFrame();
invoiceFrame.Height = "5.0cm";
invoiceFrame.Width = "6.0cm";
invoiceFrame.Left = ShapePosition.Right;
//adding table inside Invoice textFrame
table = invoiceFrame.AddTable();
table.Borders.Width = 0.75;
column = table.AddColumn(Unit.FromCentimeter(3.5));
column.Format.Alignment = ParagraphAlignment.Left;
column = table.AddColumn(Unit.FromCentimeter(3.5));
column.Format.Alignment = ParagraphAlignment.Left;
//headers for Invoice table
row = table.AddRow();
row.HeadingFormat = true;
cell = row.Cells[0];
row.Shading.Color = Colors.LightGray;
cell.AddParagraph("Date");
cell.Format.Font.Bold = true;
cell = row.Cells[1];
cell.AddParagraph("Invoice");
cell.Format.Font.Bold = true;
//defining rows and data inside Invoice table
row = table.AddRow();
cell = row.Cells[0];
cell.AddParagraph("04/30/2020");
cell = row.Cells[1];
cell.AddParagraph("2000498");
row = table.AddRow();
cell = row.Cells[0];
row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
row.Cells[0].Format.Font.Bold = true;
row.Cells[0].Shading.Color = Colors.LightGray;
row.Cells[0].MergeRight = 1;
cell.AddParagraph("Account");
row = table.AddRow();
cell = row.Cells[0];
row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
row.Cells[0].MergeRight = 1;
cell.AddParagraph("ADV Integrity");
答案
我将创建一个表格,中间有一个不可见的列。一张桌子,一个高度,问题解决了。如果您要一个单元格作为地址,则可以使用MergeDown
。
对于两个表,您可以设置行的高度以确保两个表具有相同的高度。如果单元格的内容突然不适合表格的高度,则可能导致新的问题。
以上是关于如何在同一高度的textFrame中获取两个表的主要内容,如果未能解决你的问题,请参考以下文章
如何从两个不同的 Laravel 查询构建器中获取我的两个结果集以同时显示在同一页面上?