Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » EncodeQTF Where is it?
EncodeQTF Where is it? [message #8620] Wed, 21 March 2007 20:07 Go to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
What has happened to EncodeQTF. I cannot find a reference to it in UPP source. Want to convert Rtf to Qtf and cannot use the example posted in Feb 2006.

How does one Encode QTF from RTF without it?
Re: EncodeQTF Where is it? [message #8625 is a reply to message #8620] Wed, 21 March 2007 20:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
String   AsQTF(const RichText& doc, byte charset = CHARSET_UTF8,
               dword options = QTF_BODY|QTF_ALL_STYLES|QTF_CRLF);


e.g.:

SaveFile("myfile.qtf", AsQTF(ParseRTF(LoadFile("myfile.rtf"))));



Mirek
Re: EncodeQTF Where is it? [message #8660 is a reply to message #8625] Thu, 22 March 2007 21:46 Go to previous messageGo to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
That was what I was using.
The two routines inport /export RTF


I can export text in RTF and read again in WORD.
I can create text in WORD and read in the editor.
I can create Text and images in WORD and read in the editor.

If I export text and images I can read in WORD

Text and images I export in the editor I cannot read back.
Appears to be a blank file.

Any help would be welcome.


editor below is

RichEdit editor;


// EXPORT RTF

void Editor::SaveAs() {
FileSel & fs = RTFFs();
if(fs.ExecuteSaveAs()) {
String filename = fs;
if(SaveFile(filename,EncodeRTF(ParseQTF(editor.GetQTF()),CHA RSET_UTF8))){
Exclamation("File " + filename + "was saved.");
ClearModify();
}
}
}


//IMPORT RTF
void Editor::Load() {
FileSel& fs = RTFFs();
if(fs.ExecuteOpen()) {
String filename = (String) fs;
String fileb = LoadFile(filename);
RichText& fbody = ParseRTF(fileb);
String qbody = AsQTF(fbody);
editor.SetQTF(qbody);
editor.ClearModify();
}
else
statusbar.Temporary("Loading Aborted.");
}

Re: EncodeQTF Where is it? [message #8661 is a reply to message #8660] Thu, 22 March 2007 22:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Have you checked actual .rtf file? Does it seem ok?
Re: EncodeQTF Where is it? [message #8676 is a reply to message #8620] Fri, 23 March 2007 20:16 Go to previous messageGo to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
The file will load in WORD and formats correctly.

I will modify Uword with an imoport and export and see if the problem exists there.
Re: EncodeQTF Where is it? [message #8677 is a reply to message #8620] Fri, 23 March 2007 20:36 Go to previous messageGo to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
Attached a modified version of Uword with import and export

of RTF.

Exhibits the same problem. When Exoprt RTF cannot read in again.
  • Attachment: UWord.cpp
    (Size: 5.70KB, Downloaded 492 times)
Re: EncodeQTF Where is it? [message #8682 is a reply to message #8677] Sat, 24 March 2007 16:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, fixed.

Quick patch:

RichText/ParseRTF.cpp 176


RichText RTFParser::Run()
{
	if(!PassGroup() || !PassCmd("rtf") || command_arg != 1 && !IsNull(command_arg))
		return output;
	while(Token() != T_EOF)
		ReadItem();
	Flush(false, 1);
	FlushTable(0);
	return output;
}



Mirek
Re: EncodeQTF Where is it? [message #8688 is a reply to message #8620] Sat, 24 March 2007 18:05 Go to previous messageGo to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
Thanks will incorporate change and test.

Any progress with an earlier problem with richtext I posted on 17th March.

When pasting an image in between text, the text font changes to Times New Roman rather than that before the image.

Also cannot copy an image within the page. The paste puts an earlier image in instead. Copy does not appear to ergister the image.

Thanks again for the good work and fast response.
Re: EncodeQTF Where is it? [message #8689 is a reply to message #8688] Sat, 24 March 2007 18:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
DuncanShortland wrote on Sat, 24 March 2007 13:05

Thanks will incorporate change and test.

Any progress with an earlier problem with richtext I posted on 17th March.

When pasting an image in between text, the text font changes to Times New Roman rather than that before the image.



Sorry I forgot to respond... I was unable to reproduce the bug. On my rig, everything seems to be in order.

Mirek
Re: EncodeQTF Where is it? [message #8696 is a reply to message #8689] Sun, 25 March 2007 16:44 Go to previous messageGo to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
I will try again and report back with an example
Re: EncodeQTF Where is it? [message #8703 is a reply to message #8696] Mon, 26 March 2007 11:28 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
BTW, this is serrious error:

RichText& fbody = ParseRTF(fileb);


- you are taking a reference to temporary object, which is gone by ';'.

Corrected:
RichText fbody = ParseRTF(fileb);


Mirek
Previous Topic: Richtext / Uword problems
Next Topic: QtfRichObject problem
Goto Forum:
  


Current Time: Thu Mar 28 22:39:15 CET 2024

Total time taken to generate the page: 0.01715 seconds