I need to rotate a table clockwise up to 90 degrees.
It's one of the blocks of a FlowDocument.
Is there a way to apply some kind of rotation to a Table?
The possible solution of creating TextEffect like this:
var table = new Table();
... // fill the table here
var effect = new TextEffect
{
Transform = new RotationTransform(90),
PositionStart = 0,
PositionCount = int.MaxValue
};
table.TextEffects = new TextEffectCollection();
table.TextEffects.Add(effect);
doesn't work.
Solved like this:
Instead of rotating table, put it into container and perform rotation on it.
var container = new BlockUIContainer
{
Padding = new System.Windows.Thickness(0),
Margin = new System.Windows.Thickness(0)
};
var scrollViewer = new FlowDocumentScrollViewer
{
VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
LayoutTransform = new RotateTransform(90)
};
container.Child = scrollViewer;
var tableDocument = new FlowDocument { PagePadding = new System.Windows.Thickness(0) };
// here the table is created
var table = operationStagesControl2.ConvertToXaml();
// adding table to document
tableDocument.Blocks.Add(table);
// hosting scroll viewer gets document
scrollViewer.Document = tableDocument;
// and in the end we have container with rotated table inside it