cell.Style.Rotation problem

Hi,

there is a problem with cell.Style.Rotation,

the style is done on all cell of the row and not on the cell only.

Regards

Hi,

Thanks for considering Aspose.

Well, I find no problem,

Following is my code and attached is the output file.

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A1"].Style.Rotation = 35;
workbook.Save("d:\\test\\cellsrotation.xls");
Kindly open the output file into MS Excel and insert some data into A1, A2, A3 ....cells
and you may see the only A1 cell style is affected.
If you still find the problem, could you create a sample test code to reproduce the problem and post us here.
And by the way which version of Aspose.Cells you are using... please try the lastest version 4.4.
Thank you.

It seems that when i use objSheet.Cells.InsertColumn(), the style of column 0 (or column left to inserted columns) is apply on inserted columns.

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A1"].Style.Rotation = 35;
cells["A1"].PutValue("test");
cells.InsertColumn(1);
cells["B1"].PutValue("test col 1");
workbook.Save("d:\\test\\cellsrotation.xls");

Hi,

Thanks for considering Aspose.

Well. the behaviour is the same as MS Excel (You may try to check it MS Excel). When you insert a column, MS Excel activates the format painter and by default the left most cell(s) (Left column's cells) formatting is applied to the newly inserted column's cell(s). Aspose.Cells follows the MS Excel standard so you are getting this behavior.

Thank you.

Ok, do you know how can i avoid this stupid "feature" ?

May be i can clear style on a column with aspose ?

Hi,

I think you may try remove the formats of those inserted cells in the column

E.g.,

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A1"].Style.Rotation = 35;
cells["A1"].PutValue("test");
cells.InsertColumn(1);
cells["B1"].PutValue("test col 1");
cells.ClearFormats(0,1,10,1);
workbook.Save("d:\\test\\cellsrotation.xls");
Thank you.

Ok last question, third parameter of ClearFormats is endRow of the range, but i have no idea to how many row i have to Clear.

Is there another method which only take a column index in parameter ?

Same question for a row since i saw that there is the same "features" when we insert a row.

thanks for your help

Hi,

I think you may try to use Cells.MaxDataRow and Cells.MaxDataColumn properties for your need to get the last row/column index which contains data.

E.g,

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A1"].Style.Rotation = 35;
cells["A1"].PutValue("test");
cells.InsertColumn(1);
cells["B1"].PutValue("test col 1");
int mrow = cells.MaxDataRow +1;
cells.ClearFormats(0,1,mrow,1);
workbook.Save("d:\\test\\cellsrotation.xls");

Thank you.

thanks a lot for your help.