1 diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
2 index b9c8776..a6aeee0 100644
3 --- sc/source/core/data/column3.cxx
4 +++ sc/source/core/data/column3.cxx
5 @@ -1871,10 +1871,16 @@ xub_StrLen ScColumn::GetMaxNumberStringLen( USHORT& nPrecision,
9 - { // more decimals than standard?
10 - USHORT nPrec = pNumFmt->GetFormatPrecision( nFormat );
11 - if ( nPrec > nPrecision )
14 + const SvNumberformat* pEntry = pNumFmt->GetEntry( nFormat );
17 + BOOL bThousand, bNegRed;
19 + pEntry->GetFormatSpecialInfo(bThousand, bNegRed, nPrecision, nLeading);
22 + nPrecision = pNumFmt->GetFormatPrecision( nFormat );
25 { // less than nPrecision in string => widen it
26 diff --git sc/source/ui/docshell/docsh8.cxx sc/source/ui/docshell/docsh8.cxx
27 index d12bd6a..05f4beb 100644
28 --- sc/source/ui/docshell/docsh8.cxx
29 +++ sc/source/ui/docshell/docsh8.cxx
31 #include "dbdocutl.hxx"
32 #include "dociter.hxx"
33 #include "globstr.hrc"
34 +#include "svtools/zformat.hxx"
35 +#include "svtools/intitem.hxx"
36 +#include "patattr.hxx"
37 +#include "scitems.hxx"
38 +#include "docpool.hxx"
42 using namespace com::sun::star;
45 // -----------------------------------------------------------------------
47 @@ -193,6 +201,53 @@ BOOL ScDocShell::IsDocument( const INetURLObject& rURL )
49 // -----------------------------------------------------------------------
51 +static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales)
53 + SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
57 + SCCOL nColCount = static_cast<SCCOL>(rScales.size());
58 + for (SCCOL i = 0; i < nColCount; ++i)
63 + sal_uInt32 nOldFormat;
64 + rDoc.GetNumberFormat(static_cast<SCCOL>(i), 0, 0, nOldFormat);
65 + const SvNumberformat* pOldEntry = pFormatter->GetEntry(nOldFormat);
69 + LanguageType eLang = pOldEntry->GetLanguage();
70 + BOOL bThousand, bNegRed;
71 + USHORT nPrecision, nLeading;
72 + pOldEntry->GetFormatSpecialInfo(bThousand, bNegRed, nPrecision, nLeading);
74 + nPrecision = static_cast<USHORT>(rScales[i]);
76 + pFormatter->GenerateFormat(aNewPicture, nOldFormat, eLang,
77 + bThousand, bNegRed, nPrecision, nLeading);
79 + sal_uInt32 nNewFormat = pFormatter->GetEntryKey(aNewPicture, eLang);
80 + if (nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
82 + xub_StrLen nErrPos = 0;
84 + bool bOk = pFormatter->PutEntry(
85 + aNewPicture, nErrPos, nNewType, nNewFormat, eLang);
91 + ScPatternAttr aNewAttrs( rDoc.GetPool() );
92 + SfxItemSet& rSet = aNewAttrs.GetItemSet();
93 + rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat) );
94 + rDoc.ApplyPatternAreaTab(static_cast<SCCOL>(i), 0, static_cast<SCCOL>(i), MAXROW, 0, aNewAttrs);
98 ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
99 BOOL bSimpleColWidth[MAXCOLCOUNT] )
101 @@ -308,6 +363,7 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
103 //! add type descriptions
105 + vector<long> aScales(nColCount, -1);
106 for (i=0; i<nColCount; i++)
108 String aHeader = xMeta->getColumnLabel( i+1 );
109 @@ -337,6 +393,7 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
112 aHeader += String::CreateFromInt32( nScale );
113 + aScales[i] = nScale;
117 @@ -344,6 +401,8 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
118 aDocument.SetString( static_cast<SCCOL>(i), 0, 0, aHeader );
121 + lcl_setScalesToColumns(aDocument, aScales);
123 SCROW nRow = 1; // 0 is column titles
125 while ( !bEnd && xRowSet->next() )
126 @@ -470,7 +529,6 @@ void lcl_GetColumnTypes( ScDocShell& rDocShell,
129 nDbType = sdbc::DataType::DECIMAL;
130 - bTypeDefined = TRUE;
133 if ( bTypeDefined && !nFieldLen && nToken > 2 )