Reply
 
Thread Tools Display Modes
  #1   Report Post  
Sydney Lotterby
 
Posts: n/a
Default Don't want to wrap long text - just truncate

Word 2003, SqlServer 2000 ... I am trying to print a bunch of labels (0.5" x
1.75") in a TrueType font. One of the merge fields sometimes exceeds the
width of the label and wraps. I would like to truncate it and replace the
characters with an ellipsis (...) to show something was trunc'd. How can I
do this? I can't truncate the text in the Sql select b/c I am using a
TrueType font so don't know how much space the line will actually take.

Also, the data source is a SqlServer table and I would like to be able to
write the sql script to build the source table. I couldn't find anywhere to
do that -- just a wizard that allowed me to select fields. Can this be
done?

tia


  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

I think the only way you will be able to do this is either to merge to a new
document then postprocess the results using VBA, or use VBA and the
MailMerge events . I don't have code for that - you would probably have to
use Win32 calls to get the text width in a specified font then iterate
somehow until you got a width that would fit.

Also, the data source is a SqlServer table and I would like to be able to
write the sql script to build the source table. I couldn't find anywhere
to do that -- just a wizard that allowed me to select fields. Can this be


All you can do in the standard user interface is specify a table of view,
and specify a bit of sorting and filtering (go into the Edit Recipients box,
click on the column heading of one of the columns, and select the
Advanced... option). To do more, you either have to go through MS Query, or
you have to specify the SQL in an OpenDataSource method call in VBA. To go
via MS Query, MS Query has to be installed, and you will need an ODBC DSN
for your data source (MS Query only works with ODBC, not OLEDB). When you
get to the Select Data Source dialog box, click on the Tools menu in the top
right corner and select MS Query, then follow its dialogs. Be preapred for
failure - it's sometimes quite hard to get MS Query to work with SQL Server
especially if you are not using Integrated Security.

If you go the VBA route, you will need to specify a .udl or .odc file in the
OpenDataSource statement. If you have a working .odc I would use that. Then
specify the SQL in the SQLStatement and SQLStatement1 parameters - Word
concatenates the two values to give the complete SQL statement. It does not
add any white space between the two values when it does that. If you need a
long statement, be careful because there is a limit of either around 256 or
512 characters (it depends...). You may also find that syntactically correct
SQL does not always work - I have found for example that you usually need to
specify and use table aliases even where they are not strictly necessary.

Peter Jamieson

"Sydney Lotterby" wrote in message
...
Word 2003, SqlServer 2000 ... I am trying to print a bunch of labels (0.5"
x 1.75") in a TrueType font. One of the merge fields sometimes exceeds
the width of the label and wraps. I would like to truncate it and replace
the characters with an ellipsis (...) to show something was trunc'd. How
can I do this? I can't truncate the text in the Sql select b/c I am using
a TrueType font so don't know how much space the line will actually take.

Also, the data source is a SqlServer table and I would like to be able to
write the sql script to build the source table. I couldn't find anywhere
to do that -- just a wizard that allowed me to select fields. Can this be
done?

tia




  #3   Report Post  
Sydney Lotterby
 
Posts: n/a
Default

Thanks Peter.

"Peter Jamieson" wrote in message
...
I think the only way you will be able to do this is either to merge to a
new document then postprocess the results using VBA, or use VBA and the
MailMerge events . I don't have code for that - you would probably have to
use Win32 calls to get the text width in a specified font then iterate
somehow until you got a width that would fit.

Also, the data source is a SqlServer table and I would like to be able to
write the sql script to build the source table. I couldn't find anywhere
to do that -- just a wizard that allowed me to select fields. Can this
be


All you can do in the standard user interface is specify a table of view,
and specify a bit of sorting and filtering (go into the Edit Recipients
box, click on the column heading of one of the columns, and select the
Advanced... option). To do more, you either have to go through MS Query,
or you have to specify the SQL in an OpenDataSource method call in VBA. To
go via MS Query, MS Query has to be installed, and you will need an ODBC
DSN for your data source (MS Query only works with ODBC, not OLEDB). When
you get to the Select Data Source dialog box, click on the Tools menu in
the top right corner and select MS Query, then follow its dialogs. Be
preapred for failure - it's sometimes quite hard to get MS Query to work
with SQL Server especially if you are not using Integrated Security.

If you go the VBA route, you will need to specify a .udl or .odc file in
the OpenDataSource statement. If you have a working .odc I would use that.
Then specify the SQL in the SQLStatement and SQLStatement1 parameters -
Word concatenates the two values to give the complete SQL statement. It
does not add any white space between the two values when it does that. If
you need a long statement, be careful because there is a limit of either
around 256 or 512 characters (it depends...). You may also find that
syntactically correct SQL does not always work - I have found for example
that you usually need to specify and use table aliases even where they are
not strictly necessary.

Peter Jamieson

"Sydney Lotterby" wrote in message
...
Word 2003, SqlServer 2000 ... I am trying to print a bunch of labels
(0.5" x 1.75") in a TrueType font. One of the merge fields sometimes
exceeds the width of the label and wraps. I would like to truncate it
and replace the characters with an ellipsis (...) to show something was
trunc'd. How can I do this? I can't truncate the text in the Sql select
b/c I am using a TrueType font so don't know how much space the line will
actually take.

Also, the data source is a SqlServer table and I would like to be able to
write the sql script to build the source table. I couldn't find anywhere
to do that -- just a wizard that allowed me to select fields. Can this
be done?

tia






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text wrap round a picture inside a text box SteveH999 Page Layout 4 May 9th 23 02:49 AM
I need to put long lines of text on a line without word-wrap brea. Bob barth Microsoft Word Help 1 April 1st 05 06:14 PM
Wrap text in a table row? Alesha Microsoft Word Help 1 February 3rd 05 09:46 PM
How do you make text wrap in a paragraph? cat 345 Microsoft Word Help 1 January 12th 05 04:22 PM
Outline Renee Hendershott Page Layout 2 December 25th 04 02:49 PM


All times are GMT +1. The time now is 07:46 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"