Answer the question
In order to leave comments, you need to log in
How to cancel text wrapping in a cell in code, and how to set the width of a certain column?
The code:
Sub jurnal
Dim oDoc As Object
Dim oSheet As Object
Dim Cell As Object
oDoc = ThisComponent
oSheet = oDoc.getCurrentController().ActiveSheet
oSheet.Rows.insertByIndex(0,1)
oSheet.Columns.insertByIndex(3, 1)
Cell = oSheet.getCellRangeByName("A1")
Cell.String = "Журнал телефонной базы предприятия"
Cell.CharWeight = com.sun.star.awt.FontWeight.BOLD
Cell.CharHeight = 14
Range("A1").WrapText= False
Cell = oSheet.getCellRangeByName("D2")
Cell.String = "Номер телефона"
End Sub
Answer the question
In order to leave comments, you need to log in
There seems to be a problem with the sheet. Try writing like this:
"Sheet1" is not the one under the table, but which is visible only in the code editor:
Лист1.Range("A1").WrapText = False
Лист1.Cells(1, 1).WrapText = False 'в данном случае Cells(1, 1) = Range("A1")
Лист1.Columns(4).ColumnWidth = 8 '4 - номер колонки D.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question