How to align chart title to left

I want to my chart title to be left aligned

I am using the below code:

chart.Title.TextVerticalAlignment = TextAlignmentType.Left;
chart.Title.TextHorizontalAlignment = TextAlignmentType.Left;

but the chart title is always centered.
On debugging i found a strange issue. i have attached a screenshot for same.
The issue is that even on assigning TextVerticalAlignment to left the chart property is still center.
This is clearly visible in the screen shot attached

Hi,


Thank you for using Aspose.Cells

As far as I understand your requirements, you need to set the X and Y parameters of Chart Title as follow to achieve what you want. If this is not what you require, please share with us a screenshot of your required Chart formatting and we will assist you further.

//Set Title X position
chart.Title.X = 0;

//Set Title Y position
chart.Title.Y = 0;

Also, please download and try this latest fix: Aspose.Cells for .NET (Latest Version) .

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please download and use the latest version:
Aspose.Cells for .NET (Latest Version)
and see if it resolves your problem.

If the problem still occurs, please provide us your sample code and source xls/xlsx files to replicate this issue.

Also, you only need to set the TextHorizontalAlignment, it should work fine.

I have attached an excel as to what do i require exactly:

I using the below code to set chart title properties

chart.Title.X = 0;
chart.Title.Y = 0;
chart.Title.TextVerticalAlignment = TextAlignmentType.Left;
chart.Title.TextHorizontalAlignment = TextAlignmentType.Left;

I tried with the new version of aspose and it does not solve the title alignment requirement with the same code. Moreover it is distorting my other formatting so i would want to use the version v6.0 only


Hi,

Thanks for your feedback.

It seems there is some issue with the chart’s title alignment.

I have tested it with the following code but chart’s title did not align to the left.

We have logged this issue in our database. We will look into this issue and once the issue is fixed or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-40809.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


chart.Title.TextHorizontalAlignment = TextAlignmentType.Left;


workbook.Save(filePath + “.out.xlsx”);



Hi,

Please download and try this fix: Aspose.Cells for .NET (Latest Version)

Please move the chart title by setting the title
position (Title.X and Title.Y) with the new fix.

I tried using the dll from your link but on adding it gives build errors.

I used 7.3 version but still the chart title text is not left aligned.

chart.Title.X = 0;
chart.Title.Y = 0;
chart.Title.TextVerticalAlignment = TextAlignmentType.Left;
chart.Title.TextHorizontalAlignment = TextAlignmentType.Left;

Hi,


I used the new fix v7.3.0.2 and it works fine with your file. I moved the chart’s title to upper left corner and it works fine.

Sample code:

string filePath = @“e:\test2\Pankaj.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[1];


Chart chart = worksheet.Charts[0];


chart.Title.X = 0;
chart.Title.Y = 0;


workbook.Save(filePath + “.out.xlsx”);

Please see the attached output file.

"I tried using the dll from your link but on adding it gives build errors."
Well, you need to use the latest fix i.e. v7.3.0.2 as it resolves the issue regarding moving the chart title. Please give us details what kind of errors you find when adding the new fix v7.3.0.2 to your project (as added reference) and compiling the project. We can help you to resolve the compile time errors if needed.

Thank you.


I got two files from the link which you sent me :

1.Aspose.Cells.dll
2.Aspose.Cells.tlb

I added the reference of this dll as i do for other versions but on importing by :
using Aspose.Cells;
i get the error as screenshot attached.

Hi,

It looks strange to us as it works fine here. May be you need to add/register it into GAC to make it work for your case.

There might be some conditions to make it work e.g

1 - Strong name

2 - Add it to GAC

3 - Add it to your .Net framework (e.g. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727).

Please add it to GAC and check whether it can work.

If you still could not evaluate, please create a separate project / console application, zip it and post it here, we will check it.

thank you.

Rebuscode-pankaj:
I got two files from the link which you sent me :
1.Aspose.Cells.dll
2.Aspose.Cells.tlb

I added the reference of this dll as i do for other versions but on importing by :
using Aspose.Cells;
i get the error as screenshot attached.

Hi,

From your error, it appears your are using .NET Framwork Client Profile. There is a separate dll that works on .NET Framework Client Profile.

The current dll is meant for regular .NET Frameworks and not for Client Profile(s).

We will provide you .NET Framework Client Profile dll soon which will fix this issue.

I was in middle of a delivery so till when can i expect this?

Hi,


Hopefully we can provide you the .NET Framework Client Profile compiled version of the fix tomorrow.

Thank you.

Hi,

Please download and try the latest Client Profile fix: Aspose.Cells for .NET (Latest Version)

It should fix your issue.

thank you.