Recent

Author Topic: HTML reserved characters  (Read 459 times)

fmolina

  • New Member
  • *
  • Posts: 31
HTML reserved characters
« on: July 13, 2020, 04:19:35 am »
Hi,
Sorry if this a silly question. How to write "<" in a cell? I mean programmatically, Grid.Worksheet.Cells[c, r] := ...
I know that this is a html reserved char, but I tried several ways with &lt with no success. By the way, is there a reference of the html subset implemented in TsWorkSheetGrid?
Thanks

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1001
  • Former Delphi 1-7, 10.2 User
Re: HTML reserved characters
« Reply #1 on: July 13, 2020, 04:43:47 am »
Did you check the requirements for using HTML? See the Wiki article FPSpreadsheet.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (Parallels VM)

dsiders

  • Sr. Member
  • ****
  • Posts: 378
Re: HTML reserved characters
« Reply #2 on: July 13, 2020, 05:11:18 am »
Hi,
Sorry if this a silly question. How to write "<" in a cell? I mean programmatically, Grid.Worksheet.Cells[c, r] := ...
I know that this is a html reserved char, but I tried several ways with &lt with no success. By the way, is there a reference of the html subset implemented in TsWorkSheetGrid?
Thanks


It's appears to be a subset of HTML 4/5. Looking at the source in fpshtml.pas:

Code: HTML5  [Select][+][-]
  1. <A></A>
  2. <B></B>
  3. <BR></BR>
  4. <BR/>
  5. <DEL></DEL>
  6. <DIV></DIV>
  7. <EM></EM>
  8. <FONT></FONT>
  9. <H1></H1>
  10. <H2></H2>
  11. <H3></H3>
  12. <H4></H4>
  13. <H5></H5>
  14. <H6></H6>
  15. <I></I>
  16. <INS></INS>
  17. <P></P>
  18. <S></S>
  19. <SUB></SUB>
  20. <SUP></SUP>
  21. <U></U>
  22. <TR></TR>
  23. <TH></TH>
  24. <TD></TD>
  25.  

Notable omissions:

Code: HTML5  [Select][+][-]
  1. <UL>
  2. <OL>
  3. <DL>
  4. <LI>
  5. <DT>
  6. <DD>
  7. <IMG>

As for the original question, have tried using the HTML convention?

Code: HTML5  [Select][+][-]
  1. &amp;lt;
  2. &amp;gt;
  3.  
« Last Edit: July 13, 2020, 05:15:52 am by dsiders »
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

fmolina

  • New Member
  • *
  • Posts: 31
Re: HTML reserved characters
« Reply #3 on: August 10, 2020, 09:10:49 pm »
Hi, returning to the question, for "<" this does not work. It works however for other characters, for example
Quote
&amp;leq
Shows the 'less than or equal' char.
 %)

fmolina

  • New Member
  • *
  • Posts: 31
Re: HTML reserved characters
« Reply #4 on: August 10, 2020, 09:20:24 pm »
More info:
I have a combobox in a column which has the item list '-,<,≤'; when the second item is selected, nothing is written in the cell; the other two symbol work ok.

wp

  • Hero Member
  • *****
  • Posts: 7620
Re: HTML reserved characters
« Reply #5 on: August 10, 2020, 10:09:50 pm »
with &lt with no success.
You're lacking the final semicolon: &lt;

The html is the worksheetgrid is meant to provide a way to directly enter individual character formatting which Excel calls "rich text". The corresponding html tags are queried in procedure TsHTMLAnalyzer.TagFoundHandler of unit fpsHTMLUtils:

Quote
<b>, <strong> -- bold
<br>, <br /> -- line break
<s>, <del> -- strikeout fount
<em>, <i> -- italic font
<font ...> -- font-family, face, font-size, size, color, font-style, font-decoration, font-weight
<u>, <ins> -- underline font
<sub> -- subscript
<sup> -- superscript
HTML entities are listed at the top of the implementation section of this unit.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

fmolina

  • New Member
  • *
  • Posts: 31
Re: HTML reserved characters
« Reply #6 on: August 11, 2020, 04:52:43 pm »
Thank you!

 

TinyPortal © 2005-2018