Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Export to Excel With Coloured Rows
Message
From
11/02/2013 05:02:59
 
 
To
11/02/2013 04:43:27
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01565703
Message ID:
01565709
Views:
61
>>I am Having table which contains many Rows and columns.
>>
>>I want to Export export it to .XLS and I want that If filed remarks of my Table has "N" Value that row should be highlited in RED colour in exported .XLS file.
>>
>>Kinldy Guide. How to Do This
>
>After export, open the sheet (manually or, if you're up to it, via automation) and apply formatting. If automation, you'd have to loop through the rows, check the value in the remarks cell, and if it contains that value, apply the formatting to the whole row. Now I haven't done lot of excel automation last seven years, so the syntax is probably wrong:
>
>
>oSheet=oExcel.activeSheet
>for each oRow in oSheet.rows
>    if oRow.cells(32).value="your value"
>       oRow.color=0xff0000   && or whatever goes for red in excel
>    endif
>endfor
>
>Not sure if this is the proper way to get a reference to the active sheet, maybe you need to get active workbook first, then the sheet from it. I took 32 as an example; your remarks cell may be in any column - you'll know which.

I use NumberFormat
&& Currency
.NumberFormat = '#,###.00' + '_);[Red](' + '#,###.00' + ')'

or 
.NumberFormat = '#,###.00' + '_);[Red](' + '#,###.00' + ');'
Integer
.NumberFormat = '#,###' + '_);[Red](' + '#,###' + ')'

or 
.NumberFormat = '#,###' + '_);[Red](' + '#,###' + ');'
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform