First of all I have to apologize because of my English!
Also I have to apologize because I’ve been out of line for a while, so, I couldn’t post anything here.
Now I can:
ORB is a bit strange for me and I prefer the old fashioned system, however, we can run the auto-height property working with macros ( I know you hate them, sorry!)
We have to know that the simplest ORB report has a three-table structure (one in the report header, other in the report footer and the other one which is the main table (detail table).
If you have an ORB report you can edit the document. If you edit it and then click on menu-view-text-limits, so you can see the complexity of the table in which ORB is working (comlex text-table, but only text-table).
Normally, as I’m a really bad hobby programmer, I try to figure out the number of the row (counting rows) in which I have a textbox in order to put inside the macro this row with auto-height property.
I’m sure that is more efficient to establish an indefinite cycle that run over all rows and put all of them in the ‘auto-height mode’.
If the ORB is not the simplest, you can have more and more tables, but you can calculate the rule in order to act in each table you need.
All this considerations are the same, but having also in consideration the columns, in order to use the border cells for a specific cell. This is other thing that ORB has to develop.
In the example of code I put below I run over all tables except the first and the last one. I try to detect in the first cell a specific piece of text (“SERVICIO:”), which is the signal, in this case, to work in the next table (Z+1).
Finally I run over all rows in that table in order to put all of them in auto-height way:
Code: Select all
oTexttable.getRows().getByIndex(i).IsAutoHeight = True ' Autoheight
Code: Select all
'-------------------------------------------------------------------
'1º We open the report
ocontroller = Thisdatabasedocument.currentController
if not ocontroller.isconnected then ocontroller.connect
oreportdoc = Thisdatabasedocument.reportdocuments.getbyname("Inf_ModQuirofanos_ORB").open
'===================================================================
'----------------------------------------
' We start the autheight patch
NTexttable = oreportdoc.Texttables().GetCount() ' Number of tables
For z=2 to NTexttable-1 ' We see all the tables except the first one and the last one
oTexttable = oreportdoc.Texttables(z) ' The actual table inside the cycle
Filas = oTexttable.rows.count-1 ' Rows of the table
Columnas = oTexttable.Columns.count-1 ' Columns of the table
Fila = oTexttable.rows ' Row object
'------------------------------------------------------------------------
' 2º We will inspect each table, to select the next one of which has in thefirst cell the especific text
oCell = oTextTable.getCellByPosition(0, 0) ' The first cell of table
oText = oCell.Text ' Text inside the cell
oCurs = oText.createTextCursor() ' Cursor in the cell
oCurs.gotoEND(True) ' Cursor to the end of the cell
if oCurs.GetString ="SERVICIO:" Then ' Signal to select the table
oTexttable = oreportdoc.Texttables(z+1) ' We select the nest table
Filas = oTexttable.rows.count-1 ' Rows of the table
'oCell= oTextTable.getCellByPosition(1, 0) ' Selected cell
'oCell.setPropertyValue("BackColor", RGB(255, 255, 0)) ' Colour in the selected cell
For i=0 to Filas ' We run all rows
Fila = oTexttable.rows(i) ' Specific row in each cycle
' Fila.BackColor = RGB(162,162,122) ' Colour
oTexttable.getRows().getByIndex(i).IsAutoHeight = True ' Autoheight
Next ' The next row
End if ' We finish the condition to select the table
Next ' We go to the next table
'------------------------------------------------------------
' We finish the autoheight patch
Lines as :
Code: Select all
'oCell.setPropertyValue("BackColor", RGB(255, 255, 0)) ' Colour in the selected cell
or
Code: Select all
' Fila.BackColor = RGB(162,162,122) ' Colour
were used while I was trying to detect if the code was correct or not.
Obviously the report should be opened by the macro, if not the auto-height property won’t be used.
I hope it could be useful for somebody!
Best regards!
