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.
Time new Roman on Paste HTML Text
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
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.
Thanks for asking my question and sorry , 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.
I hope you can understand me, i you can't tell me and i will try to put it in another way.
Regards.
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
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.