summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/excel/xistyle.cxx28
1 files changed, 25 insertions, 3 deletions
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 926294009575..f49b469c3066 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -69,6 +69,7 @@
#include "root.hxx"
#include "colrowst.hxx"
#include "svl/poolcach.hxx"
+#include "rsc/rscsfx.hxx"
#include <list>
@@ -1297,10 +1298,31 @@ void XclImpXF::ApplyPatternToAttrList(
// insert into document
ScDocument& rDoc = GetDoc();
- if (IsCellXF() && mpStyleSheet)
+ if (IsCellXF())
{
- // Apply style sheet. Don't clear the direct formats.
- rPat.SetStyleSheet(mpStyleSheet, false);
+ if (mpStyleSheet)
+ {
+ // Apply style sheet. Don't clear the direct formats.
+ rPat.SetStyleSheet(mpStyleSheet, false);
+ }
+ else
+ {
+ // When the cell format is not associated with any style, use the
+ // 'Default' style. Some buggy XLS docs generated by apps other
+ // than Excel (such as 1C) may not have any built-in styles at
+ // all.
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
+ if (pStylePool)
+ {
+ ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>(
+ pStylePool->Find(
+ ScGlobal::GetRscString(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PARA));
+
+ if (pStyleSheet)
+ rPat.SetStyleSheet(pStyleSheet, false);
+ }
+
+ }
}
if (nForceScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND)