Autor Beitrag
Freiberger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130

WIN XP
Delphi 7
BeitragVerfasst: Mi 08.10.08 21:23 
Hallo zusammen,

ich habe ein kleines Problem mit der FLEXCEL-Komponente.
ich möchte die Daten einer Excel-Tabelle in eine Datenbank übertragen.
Das klappt auch wunderbar (und schnell), aber !!!

Es werden nur die Zell-Werte eingetragen, egal welches Text-Format die Zelle hat.
ausblenden Delphi-Quelltext
1:
Text:= FlexCelImport.CellValue[ARow, ACol];					


Wenn die Zelle aber zB als #.##0,00 € formatiert ist, möchte ich also
12.345,67 € erhalten, statt 12345,67

Ich kann zwar das Format der Zelle auslesen...
ausblenden Delphi-Quelltext
1:
flexcelimport.CellFormatDef[ARow ,ACol ].Format;					

...aber wie bekomme ich daraus den richtigen Wert ?
Mit der Format-Funktion klappt es nicht. :oops:

Moderiert von user profile iconNarses: Color- durch Delphi-Tags ersetzt
Moderiert von user profile iconNarses: Topic aus Dateizugriff verschoben am Mi 08.10.2008 um 23:06
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 08.10.08 21:33 
Da steht in der Dokumentation etwas:
www.tmssoftware.com/.../doc/TFlxFormat.html
Ob es dazu automatische Formatierungsmöglichkeiten in die andere Richtung in der Komponente gibt solltest du wohl am besten beim Support erfragen, wenn dazu in der Dokumentation nichts steht. Ich habe mit dem Support dort ganz gute Erfahrungen gemacht und schließlich wollen die die Komponente ja verkaufen.
Freiberger Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130

WIN XP
Delphi 7
BeitragVerfasst: Mi 08.10.08 21:39 
OK, ich schau da mal nach... Danke
Freiberger Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130

WIN XP
Delphi 7
BeitragVerfasst: Do 09.10.08 20:37 
ich habe mal den Support angeschrieben.
Folgende Antwort kam...

Zitat:
CellValue does indeed return the actual value of a cell, not the formatted value.
If you want a string with the formatted value, use
XlsFormatValue1904(v.Value, Fmt.Format, Dates1904, Color)

Please take a look at the "reading files" demo (with the "apply numeric formatting") combobox checked to see an example on how it is used.


Habe nur keine Ahnung, wo ich
ausblenden Delphi-Quelltext
1:
XlsFormatValue1904(v.Value, Fmt.Format, Dates1904, Color)					
finden soll...
(im FlexCelImport ist es nicht)

Das besagte Demo gibt es bei mir nicht...

Moderiert von user profile iconNarses: Color-Tags umgewandelt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 09.10.08 20:50 
Ein Blick in Google sagt mir, dass die Funktion sich vermutlich in der Unit UFlxNumberFormat befindet ;-).
Freiberger Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130

WIN XP
Delphi 7
BeitragVerfasst: Do 09.10.08 21:12 
Hee, Dankeschön.
Darauf wäre ich jetzt in meinen Eifer nicht gekommen...
OK, jetzt klappt alles...