PDA

View Full Version : Insert columns in table


Unregistered
October 11, 2002, 19:23:46
Version 10:
Insert a table with for example 2 lines and 2 columns. Works fine.
Insert another column to the left or right. The additional column will not be limited at the page border but extends outside!
Any suggestions how to shrink all existing columns, so that the additional column will fit in the pagewidth.?
Thanks in advance.
Bernd


This message was originally posted by Bernd Orban in the old TX Text Control Support Forum.

Unregistered
October 12, 2002, 19:08:19
Problem solved with a few lines of code. If someone is interested, send Mail.
Bernd


This message was originally posted by Bernd Orban in the old TX Text Control Support Forum.

Unregistered
October 14, 2002, 13:10:38
High Yogi,
Thatīs the Code to make insert of columns "Ms-Word-like":
(TX is the name of the Textcontrol, Forms!Textverarbeitung ist name of the Form, where the control is placed)


Public Sub ColLeft()
Dim Tabellenbreitevorher As Long
Dim Tabellenbreitenachher As Long
Dim Anzahlspalten As Long
Dim Faktor As Single
Dim TableId As Integer
Dim n As Integer
With Forms!Textverarbeitung.TX
If .TableCanInsertColumn = False Then Exit Sub
TableId = .TableAtInputPos
Anzahlspalten = .TableColumns(TableId)
Tabellenbreitevorher = 0
Tabellenbreitenachher = 0
For n = 1 To Anzahlspalten
Tabellenbreitevorher = Tabellenbreitevorher + .TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt)
Next
.TableInsertcolumn txTableInsertInFront
For n = 1 To Anzahlspalten + 1
Tabellenbreitenachher = Tabellenbreitenachher + .TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt)
Next
Faktor = Tabellenbreitevorher / Tabellenbreitenachher
For n = 1 To Anzahlspalten + 1
.TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt) = .TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt) * Faktor
Next
End With
End Sub
Public Sub ColRight()
Dim Tabellenbreitevorher As Long
Dim Tabellenbreitenachher As Long
Dim Anzahlspalten As Long
Dim Faktor As Single
Dim TableId As Integer
Dim n As Integer
With Forms!Textverarbeitung.TX
If .TableCanInsertColumn = False Then Exit Sub
TableId = .TableAtInputPos
Anzahlspalten = .TableColumns(TableId)
Tabellenbreitevorher = 0
Tabellenbreitenachher = 0
For n = 1 To Anzahlspalten
Tabellenbreitevorher = Tabellenbreitevorher + .TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt)
Next
.TableInsertcolumn txTableInsertAfter
For n = 1 To Anzahlspalten + 1
Tabellenbreitenachher = Tabellenbreitenachher + .TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt)
Next
Faktor = Tabellenbreitevorher / Tabellenbreitenachher
For n = 1 To Anzahlspalten + 1
.TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt) = .TableCellAttribute(TableId, 0, n, txTableCellHorizontalExt) * Faktor
Next
End With
End Sub


This message was originally posted by Bernd Orban in the old TX Text Control Support Forum.