[英]Flow Document Table c# WPF column span to take the space of next column if available
我在 Flow Document 中創建發票,我被列跨度困擾我創建了一個包含 3 列的表,2 顯示描述(列跨度 2)和 1 顯示價格現在我被卡住了,當我有很長的描述,它轉到下一行而不是占用第 3 列的可用空間
例如我有什么:
Col1 Col2 Col3
1x Burger with 2.00
pizza
我想要的是:
Col1 Col2 Col3
1x Burger with pizza 2.00
如何在流文檔中處理這個
我的代碼:
headerTable.RowGroups[0].Rows.Add(new TableRow());
headerRow = headerTable.RowGroups[0].Rows[count];
headerRow.Cells.Add(new TableCell(new Paragraph(new Run("1x Burger with Pizza")) { TextAlignment = TextAlignment.Left, FontSize = printsize, FontWeight = semi })
{
ColumnSpan = 2
});
headerRow.Cells.Add(new TableCell(new Paragraph(new Run("2.00")) { TextAlignment = TextAlignment.Right, FontSize = printsize, FontWeight = semi }));
有人可以幫我弄這個嗎?
你可以試試這個鏈接。 如果你跟着它,window就是這樣的。
@亞薩哈立德。 你可以試試下面的代碼。
<FlowDocumentScrollViewer>
<FlowDocument>
<Table>
<Table.Columns>
<TableColumn Background="LightBlue" Width="*"/>
<TableColumn Background="Coral" Width="*"/>
<TableColumn Background="Red" Width="*"/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell>
<Paragraph>Col1</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Col2</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Col3</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="2">
<Paragraph>1x Burger with pizza</Paragraph>
</TableCell>
<TableCell>
<Paragraph>2.00</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</FlowDocumentScrollViewer>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.