Save rvhtmlimport in stringrid

General TRichView support forum. Please post your questions here
Post Reply
edossa
Posts: 7
Joined: Sat Jun 09, 2007 2:27 am

Save rvhtmlimport in stringrid

Post by edossa »

hello
I load in richviwedit a page web with rvhtmlimport, as I can make in order to save some data that serve to me in one stringrid?
thanks
sorry my english
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you load document by rvhtmlimporter from some string? Why not to use this string to assign to the stringgrid cell? I do not remember if it supports multiline text, though.
edossa
Posts: 7
Joined: Sat Jun 09, 2007 2:27 am

Save rvhtmlimport in stringrid

Post by edossa »

I read a page web with rvhtmlimporter and from richview I would want to save it or in an Array or a stringgrid. thanks
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use richview.SaveHtmlToStream or SaveToStreamEx to save document to TStringStream.
edossa
Posts: 7
Joined: Sat Jun 09, 2007 2:27 am

Post by edossa »

Hello sergey you can makes an example me as I must make in order to pass all one stringrid?
***************************
var table: TRVTableItemInfo;
MS: TMemoryStream;
begin
ms:=TMemoryStream.Create;
Memo1.Lines.LoadfromFile('F:\\dati.html');
RvHtmlImporter1.LoadHtml(memo1.Text);
ms.SaveToStream(ms);
ms.Position:=0;
rvesource.LoadTextFromStream(ms,0,0,false);
rvesource.Format;
*******************************
thanks
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I do not undestand your code.
What does ms.SaveToStream(ms) mean?

Do you want to load HTML source code in rvesource and set it to stringgrid? Why not to use StringGrid.Cells[0,0] := memo1.Text?
edossa
Posts: 7
Joined: Sat Jun 09, 2007 2:27 am

Post by edossa »

Hello excuse for my English, is not explained to me well. I load a page web in Richview and must capture some data as I can capture them (no source html) and put them in a database or stringgrid or string? thanks
edossa
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

As I understand, you need to load HTML in TRichView, save this document as text, assign this text to StringGrid cell.

This code assumes that RvHtmlImporter1.RichView = rveSource.

Code: Select all

uses RVGetText;

var 
  FileStream: TFileStream;
  StringStream: TStringStream; 
begin 
  // 1. Loading file
  FileStream := TFileStream.Create('F:\\dati.html', fmOpenRead);
  StringStream := TStringStream.Create('');
  StringStream.CopyFrom(FileStream, 0);
  FileStream.Free;
  RvHtmlImporter1.LoadHtml(StringStream.DataString);
  StringStream.Free; 
  rveSource.Format; // not necessary if you do not need to display HTML in rveSource
  // 2. Getting text
  StringStream.Cells[0,0] := GetAllText(rveSource);
edossa
Posts: 7
Joined: Sat Jun 09, 2007 2:27 am

Post by edossa »

Sergey thanks
Richview is divided from many cells? can be copied one cells x,y?
how I make in order to copy only some data that interest to me?
example:
12:00 CET Friendlies Indonesia - Jamaica 2-1

12:00
CET
Friendlies
Indonesia
Jamaica
2-1
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you want to copy TRichView table to TStringGrid?
edossa
Posts: 7
Joined: Sat Jun 09, 2007 2:27 am

Post by edossa »

I want copy only some data of RichView to stringgrid. Exists a way in order to make it? RichView is supplied of cells?
banal example:
***********
var
dato:string;
begin
dato:=richview.cell[1,10];
stringgrid.cells[1,1]:=dato;
end;
************
or in other way with same result.

thanks and sorry for the problem.
edossa
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I can make an example, but I do not understand how do you want to define part of document to copy.
There is no "richview.cell[1,10]", because TRichView does not have cells. It may include table with cells, probably several tables with cells.

If you want to get text representation of table cell, use
dato:=GetRVDataText(table.Cells[1,10].GetRVData);
GetRVDataText is defined in RVGetText unit.
edossa
Posts: 7
Joined: Sat Jun 09, 2007 2:27 am

Post by edossa »

ok but for being able to copy the text in table column for column?
Thanks
Post Reply