Click here to Skip to main content
15,790,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I´m trying to do a program that automatically put a picture in a XML template (inside the red rectangle for example).

I create a graphic in Inkscape and export it as XML
<img src="" title="Hosted by" />

Using the code below I can render all graphics except the textblock in whic an error appear " Whitespacecollapse was not found in type Span"

Dim st As New FileStream(s.FileName, FileMode.Open)
Dim gridl As New Viewbox
gridl = System.Windows.Markup.XamlReader.Load(st)

I tried to remove whitespacecollapse="preserve and too changed it for xml:space="preserve" but doesnt work.
Is there any way to keep the text format?

<?xml version="1.0" encoding="UTF-8"?>
<Viewbox xmlns="" Stretch="Uniform">
<Canvas Name="svg2" Width="744" Height="1052">
<!--Unknown tag: sodipodi:namedview-->
<!--Unknown tag: metadata-->
<Canvas Name="layer1">
<Rectangle xmlns:x="" Canvas.Left="63" Canvas.Top="50" Width="606" Height="311" RadiusY="16.246428" RadiusX="16.246428" Name="rect2985" Fill="#FFFF0000"/>
<TextBlock xmlns:x="" FontSize="40" FontWeight="Normal" FontFamily="arial" FontStyle="normal" Foreground="#FF000000" Canvas.Left="109" Canvas.Top="370" Name="text2987">
<Span whiteSpaceCollapse="preserve" FontSize="40">123</Span>
<Span whiteSpaceCollapse="preserve" FontSize="40">456</Span>
<Span whiteSpaceCollapse="preserve" FontSize="40">  7</Span>
Sergey Alexandrovich Kryukov 25-Dec-13 17:02pm    
I did it a number of times, never had any problems. How did you do it? First, saved SVG as XAML, didn't you? What's next? All I did after that is removed redundant name attributes, nothing else.
pablogvivo 3-Jan-14 10:35am    
Yeah, I saved as XAML and try load directly, in the link below I put the program with two pictures(svg and xaml), one, only shapes and the other with numbers too.

As you can see, the problem is in whiteSpaceCollapse line.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900