diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-10-25 15:10:53 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-10-25 15:13:52 -0400 |
commit | abb13e9c635aac37b56f294110b966be44120f1c (patch) | |
tree | 6db4bd8b0c4412b22d5bde587b4cac86357ab316 | |
parent | 41437e7ab00b247d8b104e1dbe45fc89da66f80f (diff) |
fdo#41369: Use the 'Default' style as the parent style.
Some buggy XLS documents such as those generated by 1C (app used in
Russia) don't include built-in style definitions, and the cell formats
in those docs are not associated with any style at all. Let's
associate them with the 'Default' style in such cases.
-rw-r--r-- | sc/source/filter/excel/xistyle.cxx | 28 |
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) |