Hi, Please review attached patch and commit to 3-5. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=49639 FILEOPEN html content .xls files shows text.csv with html tags instead of Spreadsheet contents Thanks Eike -- LibreOffice Calc developer. Number formatter stricken i18n transpositionizer. GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD
From 59961c892be4ac18e3d1d57c81448cf4ee9338e4 Mon Sep 17 00:00:00 2001 Message-Id: <59961c892be4ac18e3d1d57c81448cf4ee9338e4.1336669804.git.erack@redhat.com> From: Eike Rathke <erack@redhat.com> Date: Thu, 10 May 2012 19:05:48 +0200 Subject: [PATCH] resolved fdo#49639 import .xls with HTML as such, not CSV MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------erAck-patch-parts" This is a multi-part message in MIME format. --------------erAck-patch-parts Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit This restores the previous behavior for this content type, regression introduced with the fix for fdo#40021 c2a26cf9dab637c292e431d5cdf7bab5bbda571d --- sc/source/ui/unoobj/scdetect.cxx | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) --------------erAck-patch-parts Content-Type: text/x-patch; name="0001-resolved-fdo-49639-import-.xls-with-HTML-as-such-not.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-resolved-fdo-49639-import-.xls-with-HTML-as-such-not.patch" diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index 556d54f..59ae14b 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -737,12 +737,14 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) const sal_Size nTrySize = 80; ByteString aHeader = read_uInt8s_AsOString(rStr, nTrySize); + bool bMaybeHtml = HTMLParser::IsHTMLFormat( aHeader.GetBuffer()); + if ( aHeader.CompareTo( "{\\rtf", 5 ) == COMPARE_EQUAL ) { // test for RTF pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterRtf) ); } - else if ( bIsXLS && bMaybeText ) + else if ( bIsXLS && (bMaybeText && !bMaybeHtml) ) { aHeader = comphelper::string::stripStart(aHeader, ' '); // Detect Excel 2003 XML here only if XLS was preselected. @@ -756,7 +758,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) pFilter = pPreselectedFilter; else if ( pPreselectedFilter->GetFilterName().EqualsAscii(pFilterAscii) && bMaybeText ) pFilter = pPreselectedFilter; - else if ( HTMLParser::IsHTMLFormat( aHeader.GetBuffer() ) ) + else if ( bMaybeHtml ) { // test for HTML --------------erAck-patch-parts--
Attachment:
pgpv6COlpEcD5.pgp
Description: PGP signature