facebooktwittermenuarrow-up

GemBox Support Forum

HTML <span/> padding not being used

We are converting HTML to RTF using GemBox.Document. It looks like the conversion isn’t respecting span padding. For example:

<html><span style='padding-right: 5px;'>test1</span><span>test2</span></html>

Results in this RTF output (when viewing with WordPad there it looks like ‘test1test2’ instead of something like ‘test1 test2’):

{\rtf1\ansi\deff0\deflang0\deflangfe0{\fonttbl{\f0\fcharset0 Calibri;}}
{\colortbl;\red0\green0\blue0;}
\viewkind4\uc1\spltpgpar\paperw11907\paperh16839\margl120\margr120\margt120\margb120\gutter0\expshrtn\viewbksp1\ftnbj\aenddoc\hyphhotz360\sectd\psz9\headery708\footery708\pgndec\colsx708{\header\pard\ltrpar\sb0\sa200\sl276\slmult1\widctlpar\plain\ltrch\f0\fs24\ltrch\f0\fs22\cf1\ulnone\ulc1{\plain\ltrch\f0\fs24\ltrch\f0\fs22\cf1\ulnone\ulc1 test}
\par}
{\footer\pard\ltrpar\sb0\sa200\sl276\slmult1\widctlpar\plain\ltrch\f0\fs24\ltrch\f0\fs22\cf1\ulnone\ulc1
{\field{*\fldinst{\ltrch\f0\fs22\cf1\ulnone\ulc1 PAGE }}{*\fldrslt}}{\plain\ltrch\f0\fs24\ltrch\f0\fs22\cf1\ulnone\ulc1 of }
{\field{*\fldinst{\ltrch\f0\fs22\cf1\ulnone\ulc1 NUMPAGES }}{*\fldrslt}}
\par}
\pard\ltrpar\ri75\sb0\sa0\sl276\slmult1\widctlpar\plain\ltrch\f0\fs24\ltrch\f0\fs22\cf1\ulnone\ulc1{\plain\ltrch\f0\fs24\ltrch\f0\fs22\cf1\ulnone\ulc1 test1}{\plain\ltrch\f0\fs24\ltrch\f0\fs22\cf1\ulnone\ulc1 test2}
\par}

We are using version 3.3 (.NET Core via a nuget package)

Any possibility of this being addressed?

Thanks,
Kelly

Hi Kelly,

The HTML <span> element is represented with the document’s Run element which I’m afraid doesn’t have such formatting, see the CharacterFormat properties.

As a workaround, can you change that spacing with something else? For instance, use non-breaking space (\&nbsp;)?

Or if interested, we can add support for specifying tab elements (e.g. <span style="mso-tab-count:1">). Let me know if that would work for you.

Regards,
Mario

Mario,

Thanks for your reply. In this particular case, I have chosen to update how we generate the HTML for these cases to use &nbsp;

Thanks,
Kelly