Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
FPSpreadsheet
»
FPSpreadsheet: AV on TWorkbook.WriteToFile()
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Battery Operations
by
msintle
[
Today
at 02:56:45 pm]
How to convert Real to Bi...
by
MathMan
[
Today
at 02:34:55 pm]
Anyone interested in test...
by
Josh
[
Today
at 02:09:03 pm]
Linux snapshot zip files ...
by
Zaher
[
Today
at 01:22:21 pm]
New version of BGRABitmap
by
lainz
[
Today
at 01:15:01 pm]
[SOLVED] TLabeledEdit.Edi...
by
jipété
[
Today
at 01:09:42 pm]
Automatize build system
by
Чебурашка
[
Today
at 12:20:44 pm]
How to stay in the invali...
by
wp
[
Today
at 11:50:39 am]
lazarus controlling compi...
by
Bart
[
Today
at 11:33:03 am]
SVG thumbnails
by
domasz
[
Today
at 11:18:31 am]
Unique Instance Terminate...
by
Thaddy
[
Today
at 10:34:09 am]
i can't inatall Dam dialo...
by
TRon
[
Today
at 10:31:44 am]
CORDIC algorithms
by
Thaddy
[
Today
at 10:20:40 am]
Autentication Oracle
by
Thaddy
[
Today
at 09:16:19 am]
How to "create" a TFont a...
by
kwyan
[
Today
at 04:29:00 am]
SOLVED How to get PRAGMA ...
by
JanRoza
[
Today
at 01:36:33 am]
Component writing adding ...
by
andrew Bubble
[
Today
at 12:01:02 am]
Compare strange character...
by
nikel
[December 05, 2023, 11:33:21 pm]
Lazarus Release Candidate...
by
dbannon
[December 05, 2023, 11:18:03 pm]
Question about glibc bug ...
by
PascalDragon
[December 05, 2023, 10:22:15 pm]
Virtual Method
by
PascalDragon
[December 05, 2023, 08:51:54 pm]
Lazarus 3.9.9 Variable Wa...
by
Martin_fr
[December 05, 2023, 08:48:26 pm]
Watchlist, order of the w...
by
Martin_fr
[December 05, 2023, 08:13:55 pm]
How to 'Hello world' on l...
by
FramX
[December 05, 2023, 07:39:07 pm]
Difference between TSpeed...
by
Hansvb
[December 05, 2023, 07:29:23 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: FPSpreadsheet: AV on TWorkbook.WriteToFile() (Read 813 times)
JP-CASSOU
New member
Posts: 7
FPSpreadsheet: AV on TWorkbook.WriteToFile()
«
on:
July 13, 2023, 11:22:15 am »
Hello,
Using TWorkbook:
When not use FWorkbook.AddCellFormat(), I obtains 'List index out of bounds'
Else, I obtains 'Access violation' using TWorkbook.WriteToFile()
Logged
wp
Hero Member
Posts: 11478
Re: FPSpreadsheet: AV on TWorkbook.WriteToFile()
«
Reply #1 on:
July 13, 2023, 11:34:55 am »
Sorry, this is not enough information. Post a SMALL (!) project demonstrating the issue.
Logged
JP-CASSOU
New member
Posts: 7
Re: FPSpreadsheet: AV on TWorkbook.WriteToFile()
«
Reply #2 on:
July 13, 2023, 01:13:19 pm »
If CS.SetBorders specified : -> Access Violation, else OK
Code: Pascal
[Select]
[+]
[-]
var
CS
:
TsCellFormat
;
// TsCellFormat est un record
BS
:
TsCellBorderStyles
;
begin
BS
:
=
DEFAULT_BORDERSTYLES
;
CS
.
Name
:
=
AStyleName
;
CS
.
ID
:
=
FWorkbook
.
GetNumCellFormats
(
)
;
CS
.
VertAlignment
:
=
TsVertAlignment
.
vaCenter
;
CS
.
SetBackground
(
TsFillStyle
.
fsSolidFill
,
ACellColor
,
ACellColor
)
;
CS
.
SetFont
(
0
)
;
CS
.
SetNumberFormat
(
0
)
;
CS
.
SetHorAlignment
(
TsHorAlignment
.
haDefault
)
;
CS
.
SetVertAlignment
(
TsVertAlignment
.
vaDefault
)
;
CS
.
SetTextRotation
(
TsTextRotation
.
trHorizontal
)
;
// CS.SetBorders([]); // <-- AV in WriterToFile if specified
FWorkbook
.
AddCellFormat
(
CS
)
;
Additionnally, how to specify OOo Styles ?
Logged
wp
Hero Member
Posts: 11478
Re: FPSpreadsheet: AV on TWorkbook.WriteToFile()
«
Reply #3 on:
July 13, 2023, 03:28:11 pm »
Please post a compilable project. The project that I create from your snippet works correctly.
Code: Pascal
[Select]
[+]
[-]
program
Project1
;
uses
fpspreadsheet
,
fpstypes
,
fpsallformats
;
var
FWorkbook
:
TsWorkbook
;
FWorksheet
:
TsWorksheet
;
FCell
:
PCell
;
CS
:
TsCellFormat
;
// TsCellFormat est un record
BS
:
TsCellBorderStyles
;
ACellColor
:
TsColor
;
idx
:
Integer
;
begin
ACellColor
:
=
scRed
;
FWorkbook
:
=
TsWorkbook
.
Create
;
try
FWorksheet
:
=
FWorkbook
.
AddWorksheet
(
'Page 1'
)
;
BS
:
=
DEFAULT_BORDERSTYLES
;
// CS.Name := AStyleName;
CS
.
ID
:
=
FWorkbook
.
GetNumCellFormats
(
)
;
CS
.
VertAlignment
:
=
TsVertAlignment
.
vaCenter
;
CS
.
SetBackground
(
TsFillStyle
.
fsSolidFill
,
ACellColor
,
ACellColor
)
;
CS
.
SetFont
(
0
)
;
CS
.
SetNumberFormat
(
0
)
;
CS
.
SetHorAlignment
(
TsHorAlignment
.
haDefault
)
;
CS
.
SetVertAlignment
(
TsVertAlignment
.
vaDefault
)
;
CS
.
SetTextRotation
(
TsTextRotation
.
trHorizontal
)
;
CS
.
SetBorders
(
[
]
)
;
idx
:
=
FWorkbook
.
AddCellFormat
(
CS
)
;
FCell
:
=
FWorksheet
.
WriteText
(
0
,
0
,
'Test'
)
;
FWorksheet
.
WriteCellFormat
(
FCell
,
FWorkbook
.
GetCellFormat
(
idx
)
)
;
FWorkbook
.
WriteToFile
(
'test.xlsx'
,
true
)
;
finally
FWorkbook
.
Free
;
end
;
end
.
Quote from: JP-CASSOU on July 13, 2023, 01:13:19 pm
Additionnally, how to specify OOo Styles ?
FPSpreadsheet does not support the "Styles" introduced by Excel and LibreOffice. Every cell must be formatted individually.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
FPSpreadsheet
»
FPSpreadsheet: AV on TWorkbook.WriteToFile()
TinyPortal
© 2005-2018