Recent

Author Topic: HTML reserved characters  (Read 1532 times)

fmolina

  • New Member
  • *
  • Posts: 40
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: 2020
  • 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.

dsiders

  • Hero Member
  • *****
  • Posts: 1045
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 »
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

fmolina

  • New Member
  • *
  • Posts: 40
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: 40
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: 11830
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.

fmolina

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

 

TinyPortal © 2005-2018