Image locations change on resaves

General TRichView support forum. Please post your questions here
Post Reply
Jeanne
Posts: 7
Joined: Fri Nov 18, 2011 4:59 pm

Image locations change on resaves

Post by Jeanne »

I create my initial file using the richviewedit and I save the html to sql with
rvespImageFileName,and savehtmlEx using the rvsoOrverrideimages and rvsouseItemImagefileNames.
Like:
RveSDS.SaveHTMLEx('C:\'+ dmcat.adoQCat_dataNumber.AsString+'.txt',
dmcat.adoQMSDSNumber.AsString,'','','','',[rvsoOverrideImages, rvsoUseItemImageFileNames]);
This works perfectly.
then I try to reload the HTML back into a richviewedit using
HTMLViewer1.LoadFromString(dmcat.adoQMSDSSdsHTML.asstring);
RVHtmlViewImporter1.ImportHtmlViewer(HTMLViewer1,RveSDS);
NormalizeRichView(RveSDS.RVdata);
RveSDS.Format;
this works perfectly.
But when I make a change to the richviewedit and repeat the above first step, it changes my picture locations, how can I preserve the original file locations?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Hmm. TrvHtmlViewImporter always retains the location of the pictures.
Can you create a simple project (without a database) reproducing the problem? Send it to richviewgmailcom.
Jeanne
Posts: 7
Joined: Fri Nov 18, 2011 4:59 pm

Post by Jeanne »

That would be much to difficult, but I did find a solution that will work, it is based on where I run the exe from. I do however have another issue that maybe you can help with. upon using the following
HTMLViewer1.LoadFromString(dmcat.adoQMSDSSdsHTML.asstring); //works perfect
RVHtmlViewImporter1.ImportHtmlViewer(HTMLViewer1,RveSDS);
NormalizeRichView(RveSDS.RVdata);
RveSDS.Format;
It seems that it adds new duplicate styles to the style sheet and loses the paragraph style for my tables. where can I adjust so that it only uses the styles from the style sheet and doesn't lose the formatting on the tables?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

rvHtmlViewImporter always adds a new style if it cannot find the desired existing style. If it does it wrong, I need an example reproducing this problem.
Jeanne
Posts: 7
Joined: Fri Nov 18, 2011 4:59 pm

Post by Jeanne »

I have both of the richviewedits hooked to the same style and no matter what settings I use it always recreates the styles, it never reuses and existing style.

/* ========== Text Styles ========== */
hr { color: #000000}
body, table, span.rvts0 /* Normal text */
{
font-size: 10pt;
font-family: 'Arial', 'Helvetica', sans-serif;
font-style: normal;
font-weight: normal;
color: #000000;
text-decoration: none;
}
span.rvts1 /* MSDS Header */
{
font-size: 40pt;
font-weight: bold;
}
span.rvts2 /* Material Safety Data Sheet */
{
font-size: 16pt;
font-weight: bold;
}
span.rvts3 /* ChemicalName ID */
{
font-size: 14pt;
font-family: 'Arial Rad';
color: #000080;
}
span.rvts4 /* ChemicalNameSize10 */
{
font-family: 'Arial Rad';
}
span.rvts5 /* Bold Italic */
{
font-style: italic;
font-weight: bold;
}
span.rvts6 /* Bold */
{
font-weight: bold;
}
span.rvts7
{
font-size: 40pt;
font-weight: bold;
}
span.rvts8
{
font-size: 16pt;
font-weight: bold;
}
span.rvts9
{
font-size: 14pt;
font-family: 'arial rad';
color: #000080;
}
span.rvts10
{
}
span.rvts11
{
font-weight: bold;
}
span.rvts12
{
font-family: 'arial rad';
}
span.rvts13
{
font-style: italic;
font-weight: bold;
}
/* ========== Para Styles ========== */
p,ul,ol /* Paragraph Style */
{
text-align: left;
text-indent: 0px;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
.rvps1 /* Centered */
{
text-align: center;
}
.rvps2 /* Indent */
{
text-indent: 5px;
page-break-inside: avoid;
margin: 0px 0px 0px 5px;
}
.rvps3 /* DoubleIndent */
{
margin: 0px 0px 0px 30px;
}
.rvps4
{
background: #ff0000;
margin: 10px 0px 10px 0px;
}
.rvps5
{
text-align: center;
}
.rvps6
{
background: #c0c0c0;
margin: 10px 0px 10px 0px;
}
.rvps7
{
page-break-inside: avoid;
margin: 0px 0px 0px 5px;
}
.rvps8
{
text-indent: 5px;
page-break-inside: avoid;
margin: 0px 0px 0px 5px;
}
doesn't seem to matter of the rvHtmlImporter1.rtfreadproperties.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I just tried a simple test with loading a simple HTML containing a table.
Initially, RVStyle1.TextStyles.Count=6
After loading HTML, RVStyle1.TextStyles.Count=7 (one style is added).
After the second loading of the same HTML, RVStyle1.TextStyles.Count=7 (no styles are added, the existing style is reused).
So TrvHtmlViewImporter works as expected.

In your CSS, I really can see duplicate styles (rvts0 = rvts10, rvts6=rvts11, rvts5=rvts13). Are you sure that duplicate styles were added as a result of HTML import? In this case, I need a simple compilable project to reproduce this problem.
Jeanne
Posts: 7
Joined: Fri Nov 18, 2011 4:59 pm

Post by Jeanne »

I can view the html created upon savehtmlex, which i convert to be stored in SQl, then I reload it via the
HTMLViewer1.LoadFromString(dmcat.adoQMSDSSdsHTML.asstring); //works perfect
RVHtmlViewImporter1.ImportHtmlViewer(HTMLViewer1,RveSDS);
then i resave using savehtmlex and the extra styles are there.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I need a sample project reproducing this problem, preferably working with files instead of a database.
As I said, I cannot reproduce this problem myself.
Post Reply