Saving Documents with Graphics
Saving Documents with Graphics
Sorry if this has been asked before. I am just starting to use RV.
To start with, I am using Delphi 2006, with ZEOS connecting to MySQL 5.1.
I have been tasked to import word documents into my db. I am (for now) doing a copy/paste from an RTF file (I load the doc in word and save as RTF). I have no problems saving the doc unless there are graphics in the document. Rarely, the doc saves with no problem, but other times, I get a db error, database has gone away.
When I don't get the error, the graphics show up fine, when I get the error, I need to reconnect to the database, delete the record I was working, insert a new one, and copy/paste without the graphics, and attempt to save again.
Any idea why I get the error?
To start with, I am using Delphi 2006, with ZEOS connecting to MySQL 5.1.
I have been tasked to import word documents into my db. I am (for now) doing a copy/paste from an RTF file (I load the doc in word and save as RTF). I have no problems saving the doc unless there are graphics in the document. Rarely, the doc saves with no problem, but other times, I get a db error, database has gone away.
When I don't get the error, the graphics show up fine, when I get the error, I need to reconnect to the database, delete the record I was working, insert a new one, and copy/paste without the graphics, and attempt to save again.
Any idea why I get the error?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Does it happen on some specific documents?
RTF file may contain graphics which will be imported in TMetafile, TBitmap, TJPEGImage, and png.
To provide a correct processing of PNG, you need to use a thirdparty class (TPngObject), and register it using RV_RegisterPngGraphic and RegisterClass. If you will not call RegisterClass, saved RichView documents will not be read (if you save them as RVF)
See: http://www.trichview.com/forums/viewtopic.php?t=89
In addition, RTF files may contain references to external images in any format.
RTF file may contain graphics which will be imported in TMetafile, TBitmap, TJPEGImage, and png.
To provide a correct processing of PNG, you need to use a thirdparty class (TPngObject), and register it using RV_RegisterPngGraphic and RegisterClass. If you will not call RegisterClass, saved RichView documents will not be read (if you save them as RVF)
See: http://www.trichview.com/forums/viewtopic.php?t=89
In addition, RTF files may contain references to external images in any format.
Graphic Images
How can I figure out if the graphic embedded in the document is .PNG?
I don't think they are png files. They are mostly screen captures then inserted into the word doc directly (probably not even saved as a file between capture and insertion into the doc)
I don't think they are png files. They are mostly screen captures then inserted into the word doc directly (probably not even saved as a file between capture and insertion into the doc)
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Unfortunately, I now have another issue.
I have another unit which copies several of the RVF formatted docs together. This works without problem. I then have:
if Savedialog1.execute then
RichvieEdit1.SaveRTF(Savedialog1.filename, False)
On the SaveRTF function I get a Class EListError with message "List index out of bounds (6)
Before I added graphics to the docs, this code worked fine. Now with images in the docs, I added the PNGImages to this unit but get the EListError.
I have another unit which copies several of the RVF formatted docs together. This works without problem. I then have:
if Savedialog1.execute then
RichvieEdit1.SaveRTF(Savedialog1.filename, False)
On the SaveRTF function I get a Class EListError with message "List index out of bounds (6)
Before I added graphics to the docs, this code worked fine. Now with images in the docs, I added the PNGImages to this unit but get the EListError.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I think I know what may be causing this error. The remnants of the rtf file created stops just before the beginning of a table in the doc. The table is beyond the right margin of the doc. (I used the openaction function to import rather than cut and paste)
Now the issue is that I cannot move the table within the margins. Placing the cursor over the edge of the table changes the cursor, implying that I will be able to move the edge, but unfortunately, it doesn't actually move anything.
How do I reset the table to be within the margins?
Thanks again in advance.
Now the issue is that I cannot move the table within the margins. Placing the cursor over the edge of the table changes the cursor, implying that I will be able to move the edge, but unfortunately, it doesn't actually move anything.
How do I reset the table to be within the margins?
Thanks again in advance.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
May have found the graphic issue
Sergey,
I ultimately had yet another occurrence of the db giving me an error on trying to save a doc with graphics. I began to think the problem isn't an issue for the RichViewEdit because I attempted to save the doc as a file and I had no problems.
So I began to research BLOB field with MySQL and with my connection to the DB with ZEOS. I think the problem is due to a setting with MySQL.
You may want to make this information available for anyone using MYSQL.
here is the relevant link with MySQL to change the max_allowed_packet variable.
http://dev.mysql.com/doc/refman/5.1/en/ ... large.html
Once again, thanks for your quick replies.
I ultimately had yet another occurrence of the db giving me an error on trying to save a doc with graphics. I began to think the problem isn't an issue for the RichViewEdit because I attempted to save the doc as a file and I had no problems.
So I began to research BLOB field with MySQL and with my connection to the DB with ZEOS. I think the problem is due to a setting with MySQL.
You may want to make this information available for anyone using MYSQL.
here is the relevant link with MySQL to change the max_allowed_packet variable.
http://dev.mysql.com/doc/refman/5.1/en/ ... large.html
Once again, thanks for your quick replies.