Free Support Forum - aspose.com

Picture.right does not work

I’m using the following example:

Excel excel = new Excel();
Worksheet sheet = excel.Worksheets[0];
FileStream fs = new FileStream(“c:\tmp\gifpos\logo.gif”, FileMode.Open, FileAccess.Read);
int pos = sheet.Pictures.Add(0, 0, fs);
Picture pic = sheet.Pictures[pos];
pic.Right= 5;

sheet.Cells[“a1”].PutValue(123);

sheet.Cells[“a1”].Style.HorizontalAlignment = TextAlignmentType.Right;
sheet.Cells[“a1”].Style.IndentLevel = 2;

The image will not align itself to the right side of the cell. Am I doing something wrong?

I could use pic.Left = getColumnWidth(Convert.toByte(0))-5 but the width of the column may be changed later if a wider cell is appended.

I am using version 2.9.0.1

Picture.Right property is just a placeholder and not supported yet. We will implement it in the following releases. You will get it within 1-2 weeks.

Can you please be more specific about the date? We have 18-19000 people depending on our delivery of this feature. We can not ship the product before the Picture.right functionality is working as described in your documentation.

I will speed up to implement this feature. The planned date is the end of this week. Will it serve your need?

If the end of this week is Friday, it will serve our needs just fine.

Thank you for speedy reply.

Now it’s available. Please download v2.9.1 and have a try.

I’ve tested it and it seems to work, except that now the Picture.Top is disregarded instead. Can you please take a look at that?

Another request: Is it possible to ‘stick’ the picture to the right side of the cell? If the user decides to make the column wider, the picture does not follow as it is. Is there a feature that I am missing?

I will check this “Top” issue. And I will add a property to enable you to lock the image.

Please download and try v2.9.2 at http://www.aspose.com/Products/Aspose.Excel/Downloads.html. Picture.Top issue is fixed. And you can try to use Picture.Placement property to stick the picture.

The Picture.Placement = PlacementType.Move does not stick the picture to the right side of the cell. Am I using it wrong?

Excel excel = new Excel();
Worksheet sheet = excel.Worksheets[0];
FileStream fs = new FileStream("c:\\tmp\\gifpos\\logo.gif", FileMode.Open, FileAccess.Read);
int pos = sheet.Pictures.Add(0, 0, fs);
Picture pic = sheet.Pictures[pos];
pic.Right= 5;
pic.Placement = PlacementType.Move;
sheet.Cells["a1"].PutValue(123);
sheet.Cells["a1"].Style.HorizontalAlignment = TextAlignmentType.Right;
sheet.Cells["a1"].Style.IndentLevel = 2;

PlacementType.Move sticks the image to the left side of the cell. That’s the routine of MS Excel. I haven’t found such a feature in MS Excel to stick an image to the right side of the cell. So I don’t have an idea to do it in Aspose.Excel.

Is it possible to lock the columnwidth so the user can not change it? That way we can make sure the images stay on the right side.

You need protect the worksheet to lock the column width. Please try to lock the worksheet in your designer file or use Worksheet.Protect method.

All right.

Thank you very much for the speedy solutions.