Time new Roman on Paste HTML Text

General TRichView support forum. Please post your questions here
Post Reply
eddiev
Posts: 7
Joined: Fri Feb 17, 2006 8:41 pm

Time new Roman on Paste HTML Text

Post by eddiev »

Every Time i paste html text the RichviewEdit change me the style to Time new Roman but it dosen't change the size.
What i want is that the RichviewEdit don't change me nothing and use the Font and Size that is select at that time. How can i do that?.

Regards.
eddiev
Posts: 7
Joined: Fri Feb 17, 2006 8:41 pm

Post by eddiev »

Sorry i forgot another question. When i import HTML text with HTMLImporter i can no Undo the Paste. How can i Undo what i import with HTMLImporter?.

Regards.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

First, I do not know how you paste HTML.
Do you use Paste method, or paste it via RvHtmlImporter?
If you use Paste method, document is pasted in RTF format, and font cannot be changed.
If you use RvHtmlImporter, it has properties: DefaultFontName, DefaultFontSize.

Yes, RvHtmlImporter does not perform editing operations, so they cannot be undone.
But you can paste HTML in temporal hidden TRichView, then save document in TMemoryStream using SaveRVFFromStream, then insert in editor using InsertRVFFromStreamEd. This technique is used in RichViewActions when pasting HTML or inserting it from file.
eddiev
Posts: 7
Joined: Fri Feb 17, 2006 8:41 pm

Post by eddiev »

Thanks for asking my question and sorry :oops: , i forgot to put that i am using HtmlImporter. I found the DefaultFontName and DefaultSize and when i set the properties in the VCL component the HtmlImporter change the font and the size but when i change the properties in runtime the HtmlImporter still using the font and size that i set in the component properties.

I hope you can understand me, i you can't tell me and i will try to put it in another way.

Regards.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I'll answer this weekend, I will be away for a couple of days.
eddiev
Posts: 7
Joined: Fri Feb 17, 2006 8:41 pm

Post by eddiev »

thanks for the help. Now i can undo the HMTL Imported with the RVHtmlImporter. But now when i paste the HTML Imported using the InsertRVFFromStreamEd the background color doesn't change.

Is there an option that i am missing to copy the background style from TempRichView to RichViewEdit?.

Here is the code that i am using:

//---------------------------------------------------------------------------
void __fastcall TProdNewsWindow::RichViewEditProdPaste(
TCustomRichViewEdit *Sender, bool &DoDefault)
{
UINT CF;
TMemoryStream *MemStream;

CF = RegisterClipboardFormat("HTML Format");
if (IsClipboardFormatAvailable(CF)) {
MemStream = new TMemoryStream();
try {
RvHtmlImporter->DefaultFontName = cmbFont->Text;
RvHtmlImporter->DefaultCFontName = cmbFont->Text;
RvHtmlImporter->DefaultFontSize = StrToInt(cmbFontSize->Text);
RvHtmlImporter->DefaultCFontSize = StrToInt(cmbFontSize->Text);
RvHtmlImporter->LoadFromClipboard();
RichViewProdTemp->Format();
RichViewProdTemp->SaveRVFToStream(MemStream, false);
MemStream->Position = 0;
DoDefault = !RichViewEditProd->InsertRVFFromStreamEd(MemStream);
if (!DoDefault) {
RichViewEditProd->Format();
}
} __finally {
delete MemStream;
}
}
}


Regards.
Post Reply