473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Regarding Word 2003

49
hi i'm using MS Word2003 for my VB application which is a report. The word documents contains tables and the cells inside the table contain some fields. My application replaces the field values with Values from database.
The problem i was getting is if the text length that is replaced is more than the cell length it was not displaying at all. So i used the following code to 'autofit' the table. But it fits the text inside the cell and the cell length increases and crosses the page length. I want that it should AUOTOFIT and simultaneously WRAP the text into new line so that the the table length remain fixed. Plz if anybody having any idea share with me. I need the help urgently.

Expand|Select|Wrap|Line Numbers
  1. If (wrdFinApp.ActiveDocument.Tables.Count >= 1) Then
  2.           For liX = 1 To wrdFinApp.ActiveDocument.Tables.Count
  3.                                          With wrdFinApp.ActiveDocument.Tables(liX)
  4.                                             .AllowAutoFit = True
  5.                                             .ApplyStyleFirstColumn = True
  6.                                             .ApplyStyleHeadingRows = True
  7.                                             .ApplyStyleLastColumn = True
  8.                                             .ApplyStyleLastRow = True
  9.                                          End With
  10.          Next liX
  11. End If
Feb 23 '07 #1
9 1540
willakawill
1,646 1GB
This might help you out
Expand|Select|Wrap|Line Numbers
  1. mydoc.Tables(1).AutoFitBehavior wdAutoFitContent
Feb 23 '07 #2
amitp
49
no this is also not working. Is there is any other way to do this. let me know
Feb 27 '07 #3
willakawill
1,646 1GB
no this is also not working. Is there is any other way to do this. let me know
What is happening when you use this code?
Feb 27 '07 #4
amitp
49
hi i'm using MS Word2003 for my VB application which is a report. The word documents contains tables and the cells inside the table contain some fields. My application replaces the field values with Values from database.

The problem i was getting is if the text length that is replaced is more than the cell length, the text doesn't display rather "Display Text Cannot Span More Than One Line" is displayed.

I've two ideas for that.
1> if the text length that is to be replaced is more than the cell length, then it should make wordwrap i.e it should come into the next line without altering the original size of the table and column positions. OR
2> The cell to be AutoFit and each column value must come under the corresponding column name and the table is adjusted accordingly. But the original format of the table must retained.

To do this i used the following code , the cells values are now visible but they are not in proper position. That means one column value comes under another column name. So the total table format gets distorted.

Plz any one having any knowlegde regarding this plz help me. Below is my code. Also mention one thing when to set the property of the table, after replacing the field value or before.

Expand|Select|Wrap|Line Numbers
  1. If (wrdFinApp.ActiveDocument.Tables.Count >= 1) Then
  2.        For liX = 1 To wrdFinApp.ActiveDocument.Tables.Count
  3.                With wrdFinApp.ActiveDocument.Tables(liX)
  4.                         .AllowAutoFit = True
  5.                         .Range.Cells(liY).WordWrap = True
  6.                         .ApplyStyleFirstColumn = True
  7.                         .ApplyStyleHeadingRows = False
  8.                         .ApplyStyleLastColumn = False
  9.                         .ApplyStyleLastRow = False
  10.  
  11.                  End With
  12.          Next liX
  13.  End If

Also i tried the wordwrap property of the cells but its not working. Thanking You
Feb 27 '07 #5
amitp
49
If anybody having any solutions for my question , then plz share it with me. Thanking You
Mar 1 '07 #6
willakawill
1,646 1GB
If anybody having any solutions for my question , then plz share it with me. Thanking You
I meant what is happening when you use the code snippet that I posted?
Mar 1 '07 #7
amitp
49
The actual table size gets distorted.that means all the column gets resizes as a result of which one row becomes smaller while other is greater length than the former. but all the data gets displayed.
Mar 2 '07 #8
willakawill
1,646 1GB
The actual table size gets distorted.that means all the column gets resizes as a result of which one row becomes smaller while other is greater length than the former. but all the data gets displayed.
So all the data gets displayed. Great. What is it that does not work then?
Mar 2 '07 #9
amitp
49
The table size gets changed. Since the size of the cell changes(for which the text length is greater than the cell length), the row length incerases. But i want that all the row length should be same and each column value should be under respective column name irrespective of the change and the original table length should retain.
Mar 2 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the...
8
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and...
12
by: Cheval | last post by:
Has anyone had any problems with inter-office automation between MS Word and MS Access in Office 2003? I have recently installed office 2003 in a new folder and have left the older office 2000...
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
10
by: Neil | last post by:
An article at http://news.com.com/2100-1012-991694.html?tag=fd_top states: "XML would allow easier interchange of data generated in Office documents with back-end systems or existing Web...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
6
by: jimryder | last post by:
Hi, The following snippet: (ds is a populated dataset) string sXSLT = @"C:\XML\template\template.xsl"; string sTemp = @"C:\XML\temp\temp.xml"; string sOutput = @"C:\XML\output\output.xml";...
4
by: Lyle Fairfield | last post by:
I asked this question in Microsoft.Public.Word two days ago but I have not received an answer. I believe there are Office Experts here who may be able to help. --------- "A friend has Office...
5
by: steve | last post by:
Hi All I have a VB.net 2005 App which uses MS Word 2003 to do printing and Mail Merging, by automation All works fine on my Laptop (XP Pro SP2, Word 2003) but on my desktop (XP Pro SP2, Word...
6
by: nagar | last post by:
I need to get the list of Autocorrect entries in word. Is there a way to do it without connecting to Word? Is the list saved somewhere? If I need to connect to Word, how can I detect if it's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.