Updating Word to XAML Converter

I have done a bit of work lately on my Word 2007 to XAML converter application to give it a bit more functionality in the following areas:

  • Table
  • VML Graphics
  • Correctly handling default styles and character styles

Tables (WPF)

I have implemented rudimentary conversion from Word 2007 tables to WPF <Table> elements.  This doesn’t contain grid lines yet but the cell data is now coming over.

VML Graphics (WPF)

I have started a new XSL Transformation for VML to WPF XAML.  This has been quite trick because of the ability for WordML to contain VML elements and for VML to contain WordML elements.  I’ve implemented rectangles, rounded rectangles, and groups so far.  This gave me the ability to try out the DropShadowBitmapEffect in WPF (see XAML below):

VML in Word 2007

Here is the WPF XAML that my transform creates from the VML in Word:

                <Border x:Name="_x0000_s1029" BorderBrush="#FFf2f2f2" 
Background="#FFf79646" BorderThickness="2"
CornerRadius="22.3340148925781" Canvas.Left="-23.25pt"
Canvas.Top="-35.25pt" Height="100.5pt"> <Border.BitmapEffect> <DropShadowBitmapEffect Color="Black" Opacity=".5"
ShadowDepth="11.313708498984761" Direction="315" /> </Border.BitmapEffect> <Canvas HorizontalAlignment="Left" VerticalAlignment="Top"> <FlowDocumentPageViewer
Style="{StaticResource TextBoxFlowDocumentPageViewerStyle}"
RenderTransformOrigin="0,0" HorizontalAlignment="Left" VerticalAlignment="Top"> <FlowDocument> <!--Paragraph--> <Paragraph Style="{StaticResource Normal}"> <Run>VML to WPF XAML</Run> </Paragraph> </FlowDocument> </FlowDocumentPageViewer> </Canvas> </Border> </BlockUIContainer> </Figure>

This has been a fun project – it has given me some really good understanding of the WPF FlowDocument content model as well as the Office Open XML file formats.  Give it a try and tell me what you think.

Comments (1)

  1. In this issue: Andy Nogueira, Ken Cox, Alex Knight, Charles Petzold, Fredrik Normén, Page Brooks, Michael

Skip to main content