首页 > 解决方案 > 使用 Syncfusion 在 PdfGrid 中旋转单元格文本

问题描述

如何旋转 PDF 网格标题中的单元格值?

我不想旋转图形。

有没有办法在不使用 Graphics.RotateTransform 的情况下旋转 PdfGrid 中的单元格文本?

我有以下代码:

for (int j = 0; j < dsourceII.Rows.Count; j++)
{
    Main2dGrid.Headers[0].Cells[j+1].Value = dsourceII.Rows[j][1].ToString();
}

Main2dGrid.Headers[0].Cells[0].Value = "";
Main2dGrid.Headers[0].Cells[Main2dGrid.Columns.Count-1].Value = "";
foreach (PdfGridCell Cell in Main2dGrid.Headers[0].Cells)
{
    // Here I need to rotate all the cell value in Header[0], but not my grid

    Cell.StringFormat = STRINGformatRight;
    Cell.Style.Font = Tahoma;
    Cell.Style.Borders.All = PENWhite;
}

标签: c#syncfusion

解决方案


我们可以使用 BeginCellEvent 使用带有图形的旋转变换单独旋转 PdfGrid 标题。更多信息请参考知识库链接,

https://www.syncfusion.com/kb/6179/how-to-draw-rotated-headers-in-a-pdf-grid-using-c-and-vb-net

注意:我为 Syncfusion 工作。


推荐阅读