Parameters for font bold and alignment in Excel

Parameters for font bold and alignment in Excel

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.

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.


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.

try these,

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


You can find partial list of constants here. Translation to Fortran is trivial (replace #define with integer, parameter:: ). I think[ contains full list for Office.

Sorry, wrong URLs. Should be here and wc0993.exe.

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?

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.



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,


Marco A. Garcia
Canaima Software, Inc.

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today