'''' This code is part of Document Solutions for Imaging demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.DrawingImportsSystem.IOImportsGrapeCity.Documents.DrawingImportsGrapeCity.Documents.TextImportsGrapeCity.Documents.ImagingImportsGrapeCity.Documents.LayoutImports GCTEXT = GrapeCity.Documents.Text '' This example shows how to draw a table with cells containing rotated texts,'' using the GrapeCity.Documents.Drawing.TableRenderer and related classes.PublicClassRotatedTableTextPublicFunctionGenerateImage(ByVal pixelSize AsSize,ByVal dpi AsSingle,ByVal opaque AsBoolean,OptionalByVal sampleParams AsString() = Nothing) AsGcBitmap Dim bmp = NewGcBitmap(pixelSize.Width, pixelSize.Height, opaque, dpi, dpi)Using g = bmp.CreateGraphics(Color.White)DrawTable(g, pixelSize.Width, pixelSize.Height)EndUsingReturn bmpEndFunction PrivateSharedSubDrawTable(g AsGcGraphics, pageWidth AsSingle, pageHeight AsSingle)Dim host = NewLayoutHost()Dim view = host.CreateView(pageWidth, pageHeight) Dim rt = view.CreateRect() rt.AnchorTopLeftRight(Nothing, 30, 20, 20) Dim ta = NewTableRenderer(g, rt, FixedTableSides.TopLeftRight, rowCount:=9, columnCount:=7, gridLineColor:=Color.Transparent, gridLineWidth:=1, rowMinHeight:=20, columnMinWidth:=20) '' We set a "star" (weighted) width for the seventh column so that the table'' can expand since both the left and right sides of the table are fixed. ta.ColumnRects(6).SetStarWidth(1F) ta.RowRects(8).AppendMinHeight(70) Dim fmtNorm = NewTextFormat() With { .Font = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "FreeSans.ttf")), .FontSize = 16F, .FontSizeInGraphicUnits = True } Dim cs = NewCellStyle() With { .LineWidth = 1, .LineColor = Color.Coral, .LinePaddingAll = 1, .CornerRadius = 5, .FillColor = Color.Snow, .PaddingLeftRight = 10, .PaddingTop = 2, .PaddingBottom = 5, .TextAlignment = TextAlignment.Center, .TextFormat = fmtNorm } ta.DefaultCellStyle = cs ta.TableFrameStyle = NewFrameStyle() With { .LineWidth = 1, .LineColor = Color.CornflowerBlue, .LinePaddingAll = -3, .CornerRadius = 5, .FillColor = Color.MistyRose } '' To adjust a column width automatically we need to set'' the FixedWidth property the CellStyle to false.Dim csFlexW = NewCellStyle(cs) With { .FixedWidth = False }Dim cs270 = NewCellStyle(cs) With { .RotationAngle = 270 }'' A rotated cell also has a fixed width (which is actually a height) by default.'' If we set FixedWidth to false, the row height will be adjusted automatically.Dim cs270FlexH = NewCellStyle(cs) With { .RotationAngle = 270, .ParagraphAlignment = ParagraphAlignment.Center, .FixedWidth = False, .MaxWidth = 120 } ta.AddCell(0, 1, 1, 3, "Title 1 with a long text") ta.AddCell(NewCellStyle(cs) With {.ParagraphAlignment = ParagraphAlignment.Center},0, 4, 1, 3, "Title 2") ta.AddCell(cs270, 1, 1, 2, 1, "Vertical Title 1") ta.AddCell(cs270, 1, 2, 2, 1, "Vertical Title 2 with additional text") ta.AddCell(cs270, 1, 3, 2, 1, "Vertical Title 3") ta.AddCell(1, 4, 1, 2, "Subtitle 2.1") ta.AddCell(cs270FlexH, 2, 4, "Vertical Subtitle 2.1.1") ta.AddCell(cs270FlexH, 2, 5, "Vertical Subtitle 2.1.2 with a long, long, long, and even longer text") ta.AddCell(cs270, 3, 0, 3, 1, "Side Title 1") ta.AddCell(cs270, 6, 0, 2, 1, "Side Title 2") For r = 3To7For c = 1To3 ta.AddCell(csFlexW, r, c, (r * c).ToString())NextNext For r = 3To7For c = 4To5 ta.AddCell(csFlexW, r, c, $"row {r} column {c}")NextNext ta.AddCell(NewCellStyle(cs) With { .RotationAngle = 90, .ParagraphAlignment = ParagraphAlignment.Far, .TextAlignment = TextAlignment.Leading },1, 6, 7, 1, "Other Side") ta.AddCell(NewCellStyle(cs) With { .TextAlignment = TextAlignment.Trailing, .ParagraphAlignment = ParagraphAlignment.Far },8, 0, 1, 7, "Bottom Side") ta.Render()EndSubEndClass