W
Webtechie
Hello,
I am a developer. In my new company, I need to include my code in
documentation. So I create my documentation in Word and bring in code (from
another application) into a text box. Great.
Now they want line numbers.
So I paste the code into a blank page and go to line numbers. It changes
the indentation I had in my coding when it adds the numbers.
I am trying to write a macro to insert numbers, but can't seem to find how
to find the first row of a selection and the last row of a selection and just
loop through and insert a counter?!! I find many examples for a table, but
this is not a table. Not to mention the code for tables doesn't work for a
selection.
Example:
If CX_BUTTON2 = "T" Then
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
&GRIDLEVEL1.HIDEALLROWS();
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
&GRIDLEVEL1.SHOWALLROWS();
Else
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
&GRIDLEVEL1.HIDEALLROWS();
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
&GRIDLEVEL1.SHOWALLROWS();
End-If;
The above becomes
1. If CX_BUTTON2 = "T" Then
2. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
3. &GRIDLEVEL1.HIDEALLROWS();
4. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
5. &GRIDLEVEL1.SHOWALLROWS();
6. Else
7. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
8. &GRIDLEVEL1.HIDEALLROWS();
9. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
10. &GRIDLEVEL1.SHOWALLROWS();
11. End-If;
Not the same indentation. Can someone please tell me the code to just find
the first line of a selection and the last line of selection, so I can
iterate through the selection and put in line numbers?
Thanks.
Tony
I am a developer. In my new company, I need to include my code in
documentation. So I create my documentation in Word and bring in code (from
another application) into a text box. Great.
Now they want line numbers.
So I paste the code into a blank page and go to line numbers. It changes
the indentation I had in my coding when it adds the numbers.
I am trying to write a macro to insert numbers, but can't seem to find how
to find the first row of a selection and the last row of a selection and just
loop through and insert a counter?!! I find many examples for a table, but
this is not a table. Not to mention the code for tables doesn't work for a
selection.
Example:
If CX_BUTTON2 = "T" Then
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
&GRIDLEVEL1.HIDEALLROWS();
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
&GRIDLEVEL1.SHOWALLROWS();
Else
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
&GRIDLEVEL1.HIDEALLROWS();
&GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
&GRIDLEVEL1.SHOWALLROWS();
End-If;
The above becomes
1. If CX_BUTTON2 = "T" Then
2. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
3. &GRIDLEVEL1.HIDEALLROWS();
4. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
5. &GRIDLEVEL1.SHOWALLROWS();
6. Else
7. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_TBL);
8. &GRIDLEVEL1.HIDEALLROWS();
9. &GRIDLEVEL1 = GetRowset(Record.COMBO_DATA_BUDG);
10. &GRIDLEVEL1.SHOWALLROWS();
11. End-If;
Not the same indentation. Can someone please tell me the code to just find
the first line of a selection and the last line of selection, so I can
iterate through the selection and put in line numbers?
Thanks.
Tony