• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

How to aling images in Excel cells

Hi all,

We have a web app that uses ASPOSE.CELLS to generate an Excel version of the HTML report in order to (a) export the report to Excel and (b) produce a PDF of it.

There is a column that shows an image as a visual indicator of the results. Such images can be from 15x15 up to 65x65 pixels.

We need to align the images inside of the cells and no matter what we do, we do not seen to get it.

Can anyone help us?

Attached is a little sample of the case. The images are already set to "move and size with cells" and are not "locked".
1.xls
0
phermi
Asked:
phermi
  • 5
  • 4
1 Solution
 
Saqib Husain, SyedEngineerCommented:
The attached file contains all indicators well contained within the cells. What else do you want to do?
0
 
phermiAuthor Commented:
ALIGN THEM .... that is the topci of the post.

I need to align then horizontally and vertically in the cell as they can have different sizes !!!
0
 
Saqib Husain, SyedEngineerCommented:
Left, centre or right?
Top, bottom or middle?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
phermiAuthor Commented:
the image must be aligned TOP (vertically) and CENTERED (horizontally).

Please have in mind this is to be done programatically, not interactively using Excel.
0
 
Saqib Husain, SyedEngineerCommented:
Try this macro

Sub alignindicators()
For Each shp In ActiveSheet.Shapes
Set tlc = shp.TopLeftCell
shp.Left = tlc.Left + tlc.Width / 2 - shp.Width / 2
shp.Top = tlc.Top
Next shp
End Sub
0
 
phermiAuthor Commented:
ssaqibh: Thank you very much.

We are now looking at ways to execute that somehow. ASPOSE does nto seem to allow us to execute macros during the generation of the Excel file.

In any case, thanks.
0
 
Saqib Husain, SyedEngineerCommented:
So does that complete this question?
0
 
phermiAuthor Commented:
Yes sir. Thanks a lot
0
 
ScriptAddictCommented:
You could drop this into the worksheet under the vba before save hook if you can write to that during file generation.
0
 
phermiAuthor Commented:
ScriptAddict: Thanks. We are not sure how to do so. It will be very helpfull if you can detail it for us.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now