Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel merge/wrap cells with autoexpand rowheight
Message
De
28/06/2004 17:48:45
 
 
À
28/06/2004 16:16:36
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00918077
Message ID:
00918185
Vues:
5
Peter,
You're right, AutoFit doesn't seem to work with merged cells. A bit painful, but you could try something like this:
*-- merge some cells
z.Worksheets(1).Range("A1:C1").mergecells=.t.
*-- put some text
z.Worksheets(1).Range("A1").value=SomeText
*-- get total width of merged cells
lnWidthMergedCells=z.Worksheets(1).Range("A1").columnwidth+z.Worksheets(1).Range("B1").columnwidth+z.Worksheets(1).Range("C1").columnwidth
*-- get with of first column
lnWidthCol1=z.Worksheets(1).Range("A1").columnwidth
*-- unmerge cells
z.Worksheets(1).Range("A1").mergecells=.f.
*-- set wrapText
z.Worksheets(1).Range("A1").wrapText=.t.
*-- set width to width of merged cells
z.Worksheets(1).Range("A1").columnwidth=lnWidthMergedCells
*-- apply AutoFit
z.Worksheets(1).Range("A1").entirerow.autofit
*-- get row height
lnHeight=z.Worksheets(1).Range("A1").RowHeight
*-- restore width of first column
z.Worksheets(1).Range("A1").columnwidth=lnWidthCol1
*-- merge cells
z.Worksheets(1).Range("A1:C1").mergecells=.t.
*-- manually set row height to calculated value
z.Worksheets(1).Range("A1").RowHeight=lnHeight
HTH
Daniel
>That does not seem to do it. It does not error but the rowheight doe not increase, either.
>
>Peter
>
>
>
>>Peter,
>>You could try AutoFit. Something like this:
>>
>>oWorkSheet.Rows("1:" + ALLTRIM(STR(RECCOUNT()+1))).EntireRow.AutoFit
>>
>>
>>HTH,
>>Daniel
>>>i create an xls and merge some columns and turn on wrap.
>>>This is filled with data from a memo field.
>>>I want the row height to be expanded to whateve is needed to show the whole memofield.
>>>if there is only one line used the default of 14 is ok
>>>if the field needs 34 lines a rowheit of 14*34 is more appropriate.
>>>
>>>But i cannot find a property which would expand a row like that.
>>>
>>>What could I do?
>>>
>>>Peter
Daniel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform