旋转Windows.Documents.Table

时间:2010-04-27 12:52:50

标签: wpf flowdocument rotatetransform

我需要顺时针旋转一个桌子到90度。 它是FlowDocument的块之一。 有没有办法对表格应用某种旋转?
创建TextEffect的可能解决方案如下:


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);

不起作用。

1 个答案:

答案 0 :(得分:0)

解决这样的问题:
而不是旋转表,将其放入容器并在其上执行旋转。

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