Sign in to follow this  
Followers 0
shornw

_ExcelWriteCell() behaviour - Completed

2 posts in this topic

#1 ·  Posted (edited)

Hi all,

I have a script which writes to an Excel workbook, however I am finding an odd (not a showstopper, but as this is for someone else to use, I would like to get the cosmetics right aswell) outcome with regard to the cell formatting.

_ExcelWriteCell($wb, "Folder path", 1, 1)
_ExcelWriteCell($wb, "Collection Date", 2, 1)
_ExcelWriteCell($wb, "Collected by", 3, 1)
_ExcelWriteCell($wb, $path, 1, 3)
_ExcelWriteCell($wb, @MDAY & "/" & @MON & "/" & @YEAR & @CRLF, 2, 3)
_ExcelWriteCell($wb, @UserName, 3, 3)

When this executes, the 'Collected by' is fine, but the date in cell 2C, despite the vertical text being set to bottom, wraps, then when the cell is expanded, sits in the centre of the cell. If I write the same data in manually, it writes on one line and auto adjusts the row, although I don't expect the same behaviour when written through AutoIT, the current result looks unprofessional

There is an option _ExcelHorizontalAlignSet() but nothing for vertical alignment. I have looked at <Excel.au3> as I thought I would add an extra function, but to be honest it's beyond me how it works, the horizontal settings being -4131, -4108 and -4152 (left, centre, right).

Any suggestions would be gratefully received. Thanks for looking

Edited by shornw

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites



Sorted. For some reason, the date string was adding WS.

$date = StringStripWS(@MDAY & "/" & @MON & "/" & @YEAR & @CRLF, 8)


_ExcelWriteCell($wb, "Folder path", 1, 1)
_ExcelWriteCell($wb, "Collection Date", 2, 1)
_ExcelWriteCell($wb, "Collected by", 3, 1)
_ExcelWriteCell($wb, $path, 1, 3)
_ExcelWriteCell($wb, $date, 2, 3)
_ExcelWriteCell($wb, @UserName, 3, 3)

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0