Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28459 Discussions

Parameters for font bold and alignment in Excel

selahattin
Beginner
947 Views
I work on some excel application in fortran.
y use Autosetproperty(range,"?????", value).
I look for the parameters to make bold the cell content and to align the content to center.
Do you have any idea or any reference.
regards
0 Kudos
9 Replies
Intel_C_Intel
Employee
947 Views
First suggestion, as a reference, is naturally Autodice example in CVF but you're presumably gone through that. Required parameters, as for all Automation Servers, should be documented in the Server docs so a search within MSDN Excel developer's Kit should give some results/answers. I might be wrong but think that's boolean true/false parameter (for bold). As far as I can remember to justify text in a cell you have to use Justify method. Other good examples and sources of info you can find here.

Artur
0 Kudos
selahattin
Beginner
947 Views
Thanks for your reply.
But I couldn't neccessary information at the MSDN web site because information or samples are given using VB or VBA.
For example, it is ok to write only
HorizontalAlignment=XlRight, or XlCenter etc.
In our case, in fortran, it is required to assign a value to Xlcenter.
for instance, it is like -42620 (now y don't remember exact number) for XlRight.
I look for that value for Xlcenter, xlleft and the statement for fontbold.
Regards
0 Kudos
Intel_C_Intel
Employee
947 Views
try these,

xlLeft= -4131
xlRight= -4152
XlCenter= -4108

Artur
0 Kudos
Jugoslav_Dujic
Valued Contributor II
947 Views
You can find partial list of constants here. Translation to Fortran is trivial (replace #define with integer, parameter:: ). I think[http://download.microsoft.com/download/office95pro/constant/1/WIN98/EN-US/wc0993.exe]wc0993.exe[/url] contains full list for Office.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
947 Views
Sorry, wrong URLs. Should be here and wc0993.exe.
0 Kudos
selahattin
Beginner
947 Views
Hi Arturguzik and Jugoslavdujic,
Thanks for your supports. It works with excel constants given by you. Perfect!
But, I can not still solve the border and fontbold problem.
I try with below code but it doesn't work.
Integer , parameter:: xledgebottom = 9
....
Satatus=AutoSetproperty(range, "Borders",xledgebottom)
Satatus=AutoSetproperty(range, "font.bold",.true.)
I put "Borders" and "font.bold" definitions by making analogy to VBA.
Do you have any idea?
Regards
0 Kudos
Intel_C_Intel
Employee
947 Views
I've just tried to break trough the imported type library and dig it out. Maybe this will work (range, "RHS", .true.). If still fails I'll try to think of something else.
With borders I think that some parameters in your statement are missing.
Jugoslav, as always, will definitely be of much better assistance with this.

Artur
0 Kudos
canaimasoft
Beginner
947 Views
selahattin

The reason why you cannot set these "properties" is because they return objects; borders is a collection object and font is an object. You need to get a pointer to the font object before you can set its properties (of which bold is one). The same with the borders collection.

hope this helps,

regards,

Marco A. Garcia
Canaima Software, Inc.
www.canaimasoft.com
0 Kudos
selahattin
Beginner
947 Views
Hi Marco,
Thanks for your advice.
But, still I couldn't do it.
Would you like to give a code fragment shows this topic, please?
Thanks at advance.
0 Kudos
Reply