Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Additional spaces in text are cut when exporting to SVG (Read 212 times)
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 131
Joined: Aug 25th, 2022
Additional spaces in text are cut when exporting to SVG
Apr 7th, 2026 at 12:56pm
Print Post  
Hello, MindFusion team.
I would like to report a bug behavior happening with SvgExporter. If I try to export diagram which has text with several spaces in a row, the resulting SVG file displays text as it would always have single space between symbols. To reproduce this issue, please navigate to the attachments.
  

SvgExportIssues.rar ( 1561 KB | 8 Downloads )
test_001.svg ( 1 KB | 9 Downloads )
EItAkqZTOW.png ( 56 KB | 6 Downloads )
EItAkqZTOW.png
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 131
Joined: Aug 25th, 2022
Re: Additional spaces in text are cut when exporting to SVG
Reply #1 - Apr 7th, 2026 at 12:56pm
Print Post  
Test app
  

SvgExportIssues.rar ( 1561 KB | 8 Downloads )
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 131
Joined: Aug 25th, 2022
Re: Additional spaces in text are cut when exporting to SVG
Reply #2 - Apr 7th, 2026 at 12:57pm
Print Post  
Test app screen
  

EItAkqZTOW.png ( 56 KB | 6 Downloads )
EItAkqZTOW.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3473
Joined: Oct 19th, 2005
Re: Additional spaces in text are cut when exporting to SVG
Reply #3 - Apr 7th, 2026 at 1:19pm
Print Post  
Hi,

From SVG file you attached, it seems SvgExporter does add the spaces. Apparently ignoring them is default behavior of SVG parsers, following HTML specifications:

https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/xml:space
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/white-spac...

For time being, you could post-process exported SVG to add xml:space attribute or CSS to the root element.

Code
Select All
<svg>
  <style>
    text {
      white-space: pre;
    }
  </style>
....
</svg> 



We'll have in mind adding that by default for next release.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 131
Joined: Aug 25th, 2022
Re: Additional spaces in text are cut when exporting to SVG
Reply #4 - Apr 9th, 2026 at 10:12am
Print Post  
The solution works perfectly for single level exporting, thank you.
Another problem is that we also use exported diagrams contents for SVG nodes in our app, and it seems like spaces are lost when loading SvgDocument from stream.
Please run the attached app which creates a nested diagram with text, exports it to SVG and then adds this SVG content as SvgNode.
  

SvgExportIssues_002.zip ( 1802 KB | 10 Downloads )
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 131
Joined: Aug 25th, 2022
Re: Additional spaces in text are cut when exporting to SVG
Reply #5 - Apr 9th, 2026 at 10:14am
Print Post  
Attached screen of the app.
  

3siwehgGIL.png ( 25 KB | 10 Downloads )
3siwehgGIL.png
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 131
Joined: Aug 25th, 2022
Re: Additional spaces in text are cut when exporting to SVG
Reply #6 - Apr 9th, 2026 at 10:14am
Print Post  
Svg content which was created during exporting
  

test_002.svg ( 1 KB | 12 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3473
Joined: Oct 19th, 2005
Re: Additional spaces in text are cut when exporting to SVG
Reply #7 - Apr 10th, 2026 at 8:58am
Print Post  
We'll have to add a preserve-whitespace property to SvgContent too for that work. We'll have it in mind for next release along with SvgExporter's one.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3473
Joined: Oct 19th, 2005
Re: Additional spaces in text are cut when exporting to SVG
Reply #8 - Apr 14th, 2026 at 8:44am
Print Post  
This build adds PreserveWhitespace property to both SvgExporter and SvgContent:

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.3.1-alpha1

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 131
Joined: Aug 25th, 2022
Re: Additional spaces in text are cut when exporting to SVG
Reply #9 - Apr 14th, 2026 at 6:37pm
Print Post  
This version works perfectly! Thank you!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint