Click here to Skip to main content
15,891,940 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
apExcel.ActiveCell.MergeArea.RowHeight = _
        apExcel.ActiveSheet.StandardHeight * _
        (Int(frmProd.TextWidth(cInDef) / apExcel.ActiveCell.MergeArea.Width * nScaleFactor) + 1)


There is no textwidth property for .net how can i convert it thanks..
Posted

Something like this (and easily found on google):

VB
Dim g As Graphics = Me.CreateGraphics()
Dim textSize As Size = g.MeasureString(cInDef, Me.Font).ToSize()

apExcel.ActiveCell.MergeArea.RowHeight = _
        apExcel.ActiveSheet.StandardHeight * _
        (Int(textSize.Width / apExcel.ActiveCell.MergeArea.Width * nScaleFactor) + 1)

g.Dispose()
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900