Format from AdvMemo for further use

Have a nice day.
Can I use the highlighted text format from AdvMemo for further use?
For example:
Select * from Orders
I would generally need to identify all keywords (Select, From ..)
I process SQL from AdvMemo also for other purposes. ( To Shape in Excel/Flexcel too  )
Well thank you,
Miro

I'm not sure what you mean with "for further use". What specific kind of use are you referring to?

Are you using TAdvMemo with the SQL styler component TAdvSQLMemoStyler?

Yes. AdvMemo functionality is as expected.

I would also like to use the highlighted text from "AdvMemo" as the copy.
Specifically, I would also like to put the copy of the text to the Shape in MS Excel. 
In the same format as in "AdvMemo".is.
For object TDrawingRichString in TShapeProperties (Flexcel)
As example, I could fill a Shape / TDrawingRichString from RichEdit using the SelStart, SelLength, SelAttributes.
But in the case of AdvMemo I don't know how to proceed
Thank you for your willingness.
Miro

At this moment the only way to export the text of TAdvMemo with the formatting applied is by copying as HTML. You can do this with AdvMemo.CopyHTMLToClipboard;

I actually do this by exporting HTML to the stringstream. But the HTML output format is not simple enought, as can be accepted in "TRichString.FromHtml". I have to improve it "manually".

Do you have details abot what exact shortcoming(s) you see in the HTML output?

[/code]

I will use html result in function "TRichString.FromHtml".  (Flexcel)
This function probably accepts only mini html format:
http://www.tmssoftware.com/site/minihtml.asp
It seems that without modification, the original html will not pass

Flexcel is not using mini HTML.

We will followup with the expert on Flexcel on this.

Hi,

As Bruno said, FlexCel is not using mini HTML, but a "Excel compatible html" which is constrained to what Excel admits in a TRichString. So for example, "background-color" is ignored, since you can't change a part of the background of a cell.

Now, currently FlexCel parses <font "color"> and <font "face">, but not <font "style"> so most of the html above will be ignored. Some HTML that would work today with FlexCel could be:



<HTML>
  <BODY bgColor=#050000 LINK=#0000FF VLINK=#0000FF ALINK=#0000FF>
    

[quote]

      
             drop
             
             table
              
             if
              
             exists
              
             my_table
             ;
             
             

[/quote]

             </BODY>
             </HTML>


But I think it should be feasible to add font style support, so the original HTML will work without modifications. Once again, only what is possible to convert from HTML to internal Excel representation (TRichString). Excel doesn't support HTML directly, and mostly what you can change is limited to the font (size, name, color...)

An update: We've already modified the HTML engine so it can parse <font style=...> tags. Still as said before, only what Excel supports is imported: Basically font size, color, name and style (italics, bold). background-color can't sadly be imported as Excel doesn't support it.


Next FlexCel release will have this implemented.
Thank you for your effort. That is really good news.

PS
I intended to import only the basic font properties.to the Shape.
My html code is only the result from advMemo.SaveToHTML export.
I thought this was the only way to get the highlighted font out of the SQL highlighter in TAdvMemo.
But it seems that I'd rather do it all with AdvMemo.SaveToRTF and RTFLabel.
I have two versions, one interactive based on Application.Excel and fast "offline" based on Flexcel.
This will have a common basis: RichText.
Of course, I have to accept the writing of some code. 
It's not automatic. But I got it.
TAdvMemo - Highlighter Font Style & Font Color export
I have found the best solution for my problem: RichText using TRTFLabel.
The principle of solution is here:


function 1 ..
var
  ms            : TMemoryStream;
begin
  ..
  ms            := TMemoryStream.Create;
  try
    AdvMemo1.SaveToRTFStream( ms, False );
    ms.Position := 0;
    rtflabel1.RTF.Lines.LoadFromStream( ms );
..        
    result      := true;
  finally
    FreeAndNil( ms );
  end;
end;
    
    
function 2 ..
begin
  ..FontStyle := rtflabel1.RTF.SelAttributes.Style;
  ..FontColor := rtflabel1.RTF.SelAttributes.Color;
..
  rtflabel1.RTF.clear
end;

Then I work with classic SelStart, selLength and SelAttributes
I no longer handle HTML compatibility