11-26-2011 1:36 PM
Hi All,
I am downloading an excel from an ABAP program using OLE automation.
I am protecting few cells in the excel (not the entire sheet) but this does not allow me to insert rows in the excel.
How can we protect few cells as well as insert rows in the sheet?
Or, as an alternative is it possible to set the cells as invisible ? How do we set the 'invisible' property for selected range of cells?
Though, this issue is already discussed in SDN i could'nt find solution for the same.
Kinldy help me with your inputs.
Thanks ,
Vasuki
11-28-2011 6:57 AM
Hi.. Vasuki
You can create a range for few cells using the method insert_ranges and protect the range against input
using the method protect_range.
These methods are from the interface I_OI_SPREADSHEET.
Thanks,
Sandhya.
11-28-2011 7:01 AM
Hi Sandhya,
Thanks for the reply. I am using OLE to generate the excel adn fill data into it. How can i use PROTECT_RANGES method in this context? Can you pls help me with a sample code for the same?
Thanks,
Vasuki
11-28-2011 7:31 AM
Vasuki..
Here's the code.
**Create a range called ROUTES.
data : spreadsheet TYPE REF TO i_oi_spreadsheet.
l_w_ranges-name = 'ROUTES'.
l_w_ranges-top = 8.
l_w_ranges-left = 1.
l_w_ranges-rows = rows_number.
l_w_ranges-columns = 7.
APPEND l_w_ranges TO l_t_ranges.
CLEAR l_w_ranges.
CALL METHOD spreadsheet->insert_ranges
EXPORTING ranges = l_t_ranges
no_flush = 'X'
IMPORTING error = error
retcode = retcode.
**Protect the range.
CALL METHOD spreadsheet->protect_range
EXPORTING name = 'ROUTES'
protect = 'X'
no_flush = 'X'
IMPORTING error = errors.
APPEND errors.
Thanks,
Sandhya.