Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / November 2004

Tip: Looking for answers? Try searching our database.

replaced text in RTF2 not displaying correctly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Max Moor - 18 Nov 2004 20:54 GMT
Hi All,
       Please bear with me...

       I'm using Stephen Lebans RTF2 control to make formatted labels.

       I create a template label using bracketted field names, then,
using some code a la Duane Hookum, replace the field names with the
actual data as it's merged into a table.  The table becomes the data
source for the report that displays (or prints) the labels.

       The report has a single RTF2 control in its detail section which
is sized to be a single label.  This is repeated via the reports column
layout to make a sheet of labels. (yada yada yada)

       So...  when the report displays, the data I've inserted has spaces
interspersed through it.  A name like "Bannister," prints out as "B a
nni ster."

       For some reason, this never happens in the first two labels of a
page.  Whether laid out down then across, or across then down, the first
two labels are always okay.  I've done all kinds of experimenting with
sizing of the detail and RTF2 control, but haven't been able to find
anything that seems related to the problem.

       The other thing I notice is that if I go back to the template
label, skip down a couple lines, and type in "Bannister," that label
will thereafter display correctly.  Of course, then all my labels say
"Bannister" on them, so it's not much of a fix.  (Incidentally, non-
replaced text always prints out fine)

       I'm hoping someone can give me some idea what I'm doing wrong.  
I've beat my head to death trying to find something.  I'm no RTF expert,
so I'm down to assuming that I'm screwing something up there.  I've
included a couple of RTF strings below, hoping something will jump out
at someone.

Thanks, Max

This is the initial "template" RTF string ('\' before 'rtf1' removed so
I could paste it):

{rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS
Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Riched20 5.40.11.2212;}\viewkind4\uc1\pard\cf1\b\f0\fs16
\par
<GroupName>\b0\par
}

This is the merged "Bannister" RTF (prints "B a nni ster"):

{rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS
Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Riched20 5.40.11.2212;}\viewkind4\uc1\pard\cf1\b\f0\fs16
\par
Bannister\b0\par
}

This is the RTF with "Bannister" non-replaced text added:

{rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS
Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Riched20 5.40.11.2212;}\viewkind4\uc1\pard\cf1\b\f0\fs16
\par
<GroupName>\par
\par
Bannister\b0\par
}

Finally, this is the merged "Bannister" RTF, that prints out correctly:

{rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS
Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Riched20 5.40.11.2212;}\viewkind4\uc1\pard\cf1\b\f0\fs16
\par
Bannister\par
\par
Bannister\b0\par
}
Stephen Lebans - 18 Nov 2004 22:39 GMT
Unfortunately I have heard of this issue before. It only seems to happen
when you are building RTF strings on the fly.

There is no resolution. All other RTF controls instantiated from the MS
RTF DLL's suffer the same issue.

The last person who asked me to look at this issue was a very nice
developer from Germany I think. He was going to contact me if he ever
found a workaround but I have not heard from him.

Since the issue sounds like it may be internal to the RTF
control(wiothin it's source code) there is no direct solution. But I'd
like to try something just to make sure the RTF strings you are building
are syntactically(is that a word?) correct.

Send me a sample MDB that demonstrates the issue. I will add code to
copy your RTF strings to the Clipboard and then Return them before
insertion into the control. The Clipboard object will tell us two
things:

1) I will view the Clipboard contents directly to check for the Bug.
2) I will compare the RTF string returned via the Clipboard to your RTF
string for any differences.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> Hi All,
>     Please bear with me...
[quoted text clipped - 78 lines]
> Bannister\b0\par
> }
Max Moor - 19 Nov 2004 00:37 GMT
> Unfortunately I have heard of this issue before. It only seems to
> happen when you are building RTF strings on the fly.
[quoted text clipped - 27 lines]
> Access Code, Tips and Tricks
> Please respond only to the newsgroups so everyone can benefit.

Hi Stephen,
       I've been working on it more since this afternoon.  I think I've
   convinced myself that it's not the RTF string after all...

       Rather than hack code out to send you, I just did some clipboard
   experiments myself (thanks for the suggestion).  The same strings
   (from the merge table) that print wrong on the access report, print
   fine elsewhere.

       I went back and started looking at formatting issues after that.
   As I mentioned before, the first two labels on any page are always
   correct, so I got me wondering.  I changed the report so that only
   one label shows up on each page.  They all print correctly that way.
   

       I've done about everything I can think of around sizing of the
   control and the detail section, but nothing seems to alter the
   errors.  It seems related to how the RTF controls are grouped on a
   page...  More than two, and the errors begin.

       Any thoughts on this line?

TTFN, Max
Max Moor - 19 Nov 2004 01:54 GMT
Hi Again Stephen,

       I was looking around MSDN for clues, and found something about text
widths being calculated differently when saving to a .txt or .rtf file.  It
didn't really seem to apply to my issue, but it made me reflect that I've
never tried different fonts to see what happens.

       I've been using MS Sans Serif all along.  I switch to another font,
and VIOLA!  Everything printed correctly!  I have a billion fonts on here,
and have only checked a few.  Here's a sampling:

TT  Verdana               Regular good, Bold bad
TT  Times New Roman        All Bad
S   Sans Serif        All Bad
A   Lucida Sans        All Good
O   Garamond               All Good
S   Fixed Sys               All Bad
O   Courier New        All Good
O   Ariel               All Bad

where 'O' and 'TT' are true type, 'A' are adobe fonts, and 'S' are system
fonts.

       I'll keep looking into things, but I'm getting close to parts of the
system that are "magic boxes" to me, like character formatting and such.  
If this extra info sparks any thoughts with you, I'd sure like to hear
them.

TTFN, Max
Stephen Lebans - 21 Nov 2004 23:14 GMT
Excellent Max! I'll post your findings on the RTF2 web page.
:-)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> Hi Again Stephen,
>
>     I was looking around MSDN for clues, and found something about
text
> widths being calculated differently when saving to a .txt or .rtf file.  It
> didn't really seem to apply to my issue, but it made me reflect that I've
> never tried different fonts to see what happens.
>
>     I've been using MS Sans Serif all along.  I switch to another
font,
> and VIOLA!  Everything printed correctly!  I have a billion fonts on here,
> and have only checked a few.  Here's a sampling:
[quoted text clipped - 12 lines]
>
>     I'll keep looking into things, but I'm getting close to parts of
the
> system that are "magic boxes" to me, like character formatting and such.
> If this extra info sparks any thoughts with you, I'd sure like to hear
> them.
>
> TTFN, Max
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.