Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
FPSpreadsheet
»
How to bold some characters of a cell?
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
How to: create DLL file f...
by
paule32
[
Today
at 07:03:32 am]
For-in loop over constant...
by
dbannon
[
Today
at 06:44:53 am]
Distro has depreciated qt...
by
dbannon
[
Today
at 06:30:51 am]
how to using CryptoLib4Pa...
by
gfmstudio
[
Today
at 06:29:30 am]
TBGRABitmap.TextSize retu...
by
hedgehog
[
Today
at 06:29:29 am]
TiniFile alters inifile c...
by
polinkuer12
[
Today
at 05:27:15 am]
[solved]FP IDE(FP.exe) fa...
by
gasensor
[
Today
at 03:00:19 am]
ThumbControl : how to loa...
by
the_magik_mushroom
[
Today
at 01:48:57 am]
[solved] Iteration of cla...
by
Joanna
[
Today
at 01:45:47 am]
leetcode doesn’t support ...
by
Joanna
[
Today
at 01:18:56 am]
Demoscene Square dot flag...
by
TRon
[
Today
at 01:10:22 am]
How does Castle Game Eng...
by
michalis
[
Today
at 01:07:14 am]
How to use the Event Log?
by
piola
[
Today
at 12:18:19 am]
[solved] Lazarus does not...
by
RayoGlauco
[
Today
at 12:09:11 am]
Azure sql database will n...
by
wpflum
[April 15, 2024, 09:04:08 pm]
Your best UI design - con...
by
Lulu
[April 15, 2024, 08:51:36 pm]
Is it possible to open a ...
by
Martin_fr
[April 15, 2024, 08:50:05 pm]
JCF - File location query...
by
bglazuser
[April 15, 2024, 08:02:40 pm]
Adding a named separator
by
440bx
[April 15, 2024, 06:54:21 pm]
SDL2 Software_Render
by
mosquito
[April 15, 2024, 06:36:41 pm]
RayLib 5.0
by
mosquito
[April 15, 2024, 06:35:40 pm]
How can I draw a rectangl...
by
TRon
[April 15, 2024, 06:20:57 pm]
Does anyone know how to p...
by
paule32
[April 15, 2024, 06:07:15 pm]
[re-opened] Package PPU l...
by
CCRDude
[April 15, 2024, 06:07:09 pm]
BUG REPORT: Unable to gen...
by
gasensor
[April 15, 2024, 06:03:15 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to bold some characters of a cell? (Read 2078 times)
Jvan
Full Member
Posts: 181
How to bold some characters of a cell?
«
on:
April 13, 2021, 10:06:51 pm »
I wanna bolt from character 0 to 5, for instance. How to do it?
Logged
wp
Hero Member
Posts: 11906
Re: How to bold some characters of a cell?
«
Reply #1 on:
April 14, 2021, 12:36:50 am »
You can add an optional array of "rich-text parameters" to the WriteText command; each element of this array contains the character index at which the font specified by its font index will be applied until revoked by another rich-text element.
It is easier, however, when you write html codes to the cell:
Code: Pascal
[Select]
[+]
[-]
program
Project1
;
uses
fpspreadsheet
,
fpstypes
,
fpsopendocument
;
var
wb
:
TsWorkbook
;
sh
:
TsWorksheet
;
begin
wb
:
=
TsWorkbook
.
Create
;
try
sh
:
=
wb
.
AddWorksheet
(
'Page 1'
)
;
sh
.
WriteTextAsHTML
(
0
,
0
,
'<b>12345</b>6789'
)
;
sh
.
WriteTextAsHTML
(
1
,
0
,
'This is <b>bold</b>.'
)
;
sh
.
WriteTextAsHTML
(
2
,
0
,
'10 cm<sup>3</sup>'
)
;
sh
.
WriteTextAsHTML
(
3
,
0
,
'<font color="red">red</font> <font color="green">green</font> <font color="blue">blue</font>'
)
;
sh
.
WriteTextAsHTML
(
4
,
0
,
'This is <u><i>important</i></u>'
)
;
sh
.
WriteTextAsHTML
(
5
,
0
,
'This is <s>wrong</s>'
)
;
wb
.
WriteToFile
(
'test.ods'
,
true
)
;
finally
wb
.
Free
;
end
;
end
.
See also:
https://wiki.lazarus.freepascal.org/FPSpreadsheet#Rich-text_formatting
Logged
Jvan
Full Member
Posts: 181
Re: How to bold some characters of a cell?
«
Reply #2 on:
April 14, 2021, 03:12:04 am »
Thanks, it works.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
FPSpreadsheet
»
How to bold some characters of a cell?
TinyPortal
© 2005-2018