Bug Report T289103
Visible to All Users

HTML import - Table width is calculated incorrectly when the TD tag's "width" attribute is set to 100% for one of the cells

created 9 years ago

Hi,

When I insert this HTML in rtfeditor:

HTML
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title></title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> <meta charset='utf-8'> <style type='text/css'> p { margin: .1em 0; font-family: Arial; font-size: 12px; } td { margin: .1em 0; font-family: Arial; font-size: 12px; text-align: left; } body { margin: .1em 0; font-family: Arial; font-size: 12px; text-align: left; } div { margin: .1em 0; font-family: Arial; font-size: 12px; text-align: left; } </style> </head> <body> <div style='width: 100%; text-align: left' class='styleBlocPrintDocCpt'> <table style="width: 100%; border-collapse: collapse;"> <tbody> <tr> <td style="width: 1px; padding-right: 5px; vertical-align: top;"> <img src='http://localhost:59974/externe/fichier/mascaron/temp/561/5.jpg' width='128' height='128' /></td> <td style="width: 50%; text-align: left; vertical-align: top;"> <p><span style="font-family: Tahoma;"><span style="font-size: 10pt;"><strong><span style="font-size: 8pt;">PopSoft</span></strong></span></span></p> <p><span style="font-size: 8pt;"><span style="font-family: Tahoma;">1 rue des Cadets de la France Libre</span></span></p> <p><span style="font-size: 8pt;"><span style="font-family: Tahoma;"></span></span></p> <p><span style="font-size: 8pt;"><span style="font-family: Tahoma;">69003 Lyon </span></span></p> <p><span style="font-size: 8pt;"><span style="font-family: Tahoma;">France</span></span></p> <p><span style="font-family: Tahoma;"><span style="font-size: 10pt;"><span style="font-size: 8pt;">Siret: <em></em>NAF:</span><em><span style="font-size: 8pt;"> </span></em></span></span></p> <p> <br /> </p> </td> <td style="width: 50%; text-align: right; padding-left: 5px; vertical-align: bottom;"> <p> <span style="font-family: Tahoma;"><span style="font-size: 10pt;"><strong><span style="font-size: 8pt;">AVANT-MARDI</span></strong></span></span> </p> <p><span style="font-size: 8pt;"><span style="font-family: Tahoma;"><strong>&nbsp; WILLIAMS&nbsp;BLOCH</strong></span></span></p> <p><span style="font-size: 8pt;"><span style="font-family: Tahoma;"><em></em></span></span></p> <p><span style="font-size: 8pt;"><em><span style="font-family: Tahoma;"></span></em></span></p> <p><span style="font-size: 8pt;"><em><span style="font-family: Tahoma;"></span></em></span></p> <p><span style="font-family: Tahoma;"><span style="font-size: 10pt;"><span style="font-size: 8pt;"><em>France</em><br /> </span></span></span></p> </td> </tr> </tbody> </table> <p> <br /> </p> <p style="text-align: right;"><span style="font-family: Tahoma;"><span style="font-size: 14pt;"><span style="font-size: 10pt;"><strong><span style="font-size: 12pt;">Devis</span></strong><span style="font-size: 12pt;"> - [Année]/[Numéro]</span></span></span></span></p> <p style="text-align: right;"><span style="font-family: Tahoma;">[Date document]</span></p> <p style="text-align: left;"> <br /> </p> </div> <div style='width: 100%; text-align: left' class='styleBlocPrintDocCpt'> <table style="width: 100%; font-size: 12px; border-collapse: collapse;"> <tbody> <tr> <td style="width: 1px; vertical-align: top;" rowspan="2"> <img src='http://localhost:59974/img/produit.png' width='64' height='64' /></td> <td style="width: 100%; text-align: left; vertical-align: top;"> <p> <strong></strong> <br /> </p> </td> <td style="text-align: right; vertical-align: bottom; white-space: nowrap;" rowspan="2"><span style="color: silver;">Total&nbsp;HT </span> <br /> <strong>2,00 €</strong></td> </tr> <tr> <td style="text-align: right; vertical-align: bottom;"> <span style="color: silver;">Prix unitaire HT: </span>2,00 €&nbsp;•&nbsp;<span style="color: silver;">Qte: </span>1,00&nbsp;•&nbsp;<span style="color: silver;">Tva: </span>0,00 € (0,00)&nbsp;•&nbsp;&nbsp;<span style="color: red;"></span> </td> </tr> </tbody> </table> </div> <div style='width: 100%; text-align: left' class='styleBlocPrintDocCpt'> <table style="width: 100%; font-size: 12px; border-collapse: collapse;"> <tbody> <tr> <td style="width: 1px; vertical-align: top;" rowspan="2"> <img src='http://localhost:59974/img/produit.png' width='64' height='64' /></td> <td style="width: 100%; text-align: left; vertical-align: top;"> <p> <strong></strong> <br /> </p> </td> <td style="text-align: right; vertical-align: bottom; white-space: nowrap;" rowspan="2"><span style="color: silver;">Total&nbsp;HT </span> <br /> <strong>1,00 €</strong></td> </tr> <tr> <td style="text-align: right; vertical-align: bottom;"> <span style="color: silver;">Prix unitaire HT: </span>1,00 €&nbsp;•&nbsp;<span style="color: silver;">Qte: </span>1,00&nbsp;•&nbsp;<span style="color: silver;">Tva: </span>0,00 € (0,00)&nbsp;•&nbsp;&nbsp;<span style="color: red;"></span> </td> </tr> </tbody> </table> </div> <div style='width: 100%; text-align: left' class='styleBlocPrintDocCpt'> <table style="width: 100%; border-collapse: collapse;" cellspacing="0" cellpadding="3"> <tbody> <tr> <td style="border-image: none; width: 1px; vertical-align: top; white-space: nowrap;"><span style="font-size: 8pt;"><span style="font-family: Tahoma;">Résumé TVA: 0,00%: 0,00 €</span></span></td> <td style="border-image: none; width: 100%;"> <div style="text-align: right;">&nbsp;<span style="font-family: Tahoma;"><span style="font-size: 10pt;"><span style="font-size: 8pt;">Règlement par chèque à l'ordre de <strong></strong></span></span></span></div> <p style="text-align: right;"><span style="font-size: 8pt;"><span style="font-family: Tahoma;">Par virement sur <strong></strong></span></span></p> <p style="text-align: right;"><span style="font-family: Tahoma;"><span style="font-size: 10pt;"><span style="font-size: 8pt;">IBAN: <strong></strong>Cle BIC: </span><strong><span style="font-size: 8pt;"></span></strong></span></span></p> </td> </tr> </tbody> </table> <div style="text-align: left;"> <br /> </div> <br /> </div> </body> </html>

It's ok in word but not the pdf

My code:

Visual Basic
Rtf.Unit = DevExpress.Office.DocumentUnit.Centimeter Dim HtmlTotal As New System.Text.StringBuilder HtmlTotal.Append(Me.pLigneEnteteDoc.pHtmlGenerePrint) For Each Lig As cWrapDcptBloc In Me.pLstLigneProduit HtmlTotal.Append(Lig.pHtmlGenerePrint) Next HtmlTotal.Append(Me.pLignePiedDoc.pHtmlGenerePrint) Rtf.HtmlText = "" & _ "<!DOCTYPE html>" & _ "<html xmlns=""http://www.w3.org/1999/xhtml"">" & _ "<head>" & _ "<title></title>" & _ "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" & _ "<meta charset='utf-8'>" & _ "<style type='text/css'>" & _ "p {margin: .1em 0;font-family:Arial;font-size:12px;}" & _ "td {margin: .1em 0;font-family:Arial;font-size:12px;text-align:left;}" & _ "body {margin: .1em 0;font-family:Arial;font-size:12px;text-align:left;}" & _ "div {margin: .1em 0;font-family:Arial;font-size:12px;text-align:left;}" & _ "</style>" & _ "</head>" & _ "<body>" & _ HtmlTotal.ToString & _ "</body>" & _ "</html>" Rtf.Document.BeginUpdate() Dim firstSection As DevExpress.XtraRichEdit.API.Native.Section = Rtf.Document.Sections(0) firstSection.DifferentFirstPage = False firstSection.Page.PaperKind = Drawing.Printing.PaperKind.A4 firstSection.Margins.Top = 2.5 firstSection.Margins.Bottom = 2.5 firstSection.Margins.Left = 2.5 firstSection.Margins.Right = 2.5 firstSection.Margins.HeaderOffset = 0.6 firstSection.Margins.FooterOffset = 0.6 Rtf.Document.EndUpdate() Dim Rep As String = Me._context.mGetNewRepertoireInternetTemporaire Rtf.SaveDocument(Me._context.mRepertoireInternetTORepertoireMachine(Rep & "/save.doc"), DevExpress.XtraRichEdit.DocumentFormat.Doc) Process.Start(Me._context.mRepertoireInternetTORepertoireMachine(Rep & "/save.doc")) Rep = Rep & "/" & Me.pNomDocument & "-" & Me.pNumDocument & ".pdf" Using F As New System.IO.FileStream(Me._context.mRepertoireInternetTORepertoireMachine(Rep), IO.FileMode.Create) Dim F2 As New DevExpress.XtraPrinting.PdfExportOptions F2.DocumentOptions.Author = "Mascaron" F2.DocumentOptions.Title = Me.pNomDocument & "-" & Me.pNumDocument Rtf.ExportToPdf(F, F2) End Using pPathNomInternetPdf = Rep End Using

See the word and pdf in zip

Can you help me on this ?
Thanks
Sylo

Answers approved by DevExpress Support

created 9 years ago

We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

    created 9 years ago

    Hi,

    The cause of the issue is in the fact that our Rich Edit Document Server does not support the DIV tag entirely and, thus text in a table cell with the "text-align" attribute set to "right" is rendered incorrectly. The Rich Edit Document Server is a text processor, not an HTML editor. The component can open and save HTML files, however, when an HTML document is opened, it is converted into the internal Rich Edit Document Server document model and some formatting may be lost. You can find a list of supported HTML tags here: HTML Tag Interpretation.

    As an alternative solution, you can use our  ASPxHtmlEditor editor to convert HTML text into PDF. You can make the editor invisible by setting the ASPxHtmlEditor.Visible property to False. The editor's server-side code will operate as expected in this case. Note that this editor is applicable only for a web application.

      Show previous comments (6)
      DevExpress Support Team 9 years ago

        Hello,
        Our developers are working on this problem and doing their best to resolve it as soon as possible.
        You will receive an e-mail message when the status of this ticket is changed.

          this ticket have two month…
          Do you have an answer on it ?
          It's very important for me now because I need to give my product for my user and I can't if I have not a soluce on this
          Thanks
          Sylo

          DevExpress Support Team 9 years ago

            Hi,

            Thank you for your feedback. We understand that this issue is important and urgent for you. In fact, changing this behavior requires significant rewriting the Rich Edit Document Server's HTML importing engine. Therefore, I cannot say precisely when this issue will be fixed. We will keep you informed of our progress.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.