Kaydet (Commit) d2a19aad authored tarafından sushil_shinde's avatar sushil_shinde Kaydeden (comit) Miklos Vajna

fdo#78654 LO was exporting corrupt docx file.

   If docx file contains multiple hyperlinks in one paragraph
   and one of the hyperlink contains "PAGEREF" field. End tag
   for "PAGEREF" field was not exported hence it was causing
   corruption in exported file.
   Fixed export part of field end tags in case of "PAGEREF".
   Added unit test.

Change-Id: I18a3625213bf7269e3f441859a27acc38cf6ff45
Reviewed-on: https://gerrit.libreoffice.org/9364Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst c3ed5f6d
......@@ -3370,6 +3370,17 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78384,"fdo78384.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:rFonts","ascii","Wingdings");
}
DECLARE_OOXMLEXPORT_TEST(testFDO78654 , "fdo78654.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
// In case of two "Hyperlink" tags in one paragraph and one of them
// contains "PAGEREF" field then field end tag was missing from hyperlink.
assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:hyperlink[3]/w:r[5]/w:fldChar", "fldCharType", "end" );
}
DECLARE_OOXMLEXPORT_TEST(testfdo78599,"fdo78599.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
......
......@@ -823,6 +823,8 @@ void DocxAttributeOutput::EndRun()
FSNS( XML_w, XML_fldCharType ), "separate",
FSEND );
m_pSerializer->endElementNS( XML_w, XML_r );
// At start of every "PAGEREF" field m_endPageRef value should be true.
m_endPageRef = true;
}
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment