Setting CellFormat.TextOrientation Changes Alignment

If you set a cell’s text orientation to Upward or Downward, the cell’s
horizontal alignment changes from “Left” to “Center”. I think
this is a bug, since performing the same operation in MS Word does not
change the alignment.

When I perform the following code on a document containing table:

string filename = Application.StartupPath + "\\CellOrientation.doc";

Document doc = new Document(filename);

Cell cell = (Cell)doc.GetChild(NodeType.Cell, 0, true);

cell.CellFormat.Orientation = TextOrientation.Upward;

doc.Save(System.IO.Path.GetFileNameWithoutExtension(filename) + "_modified.doc");

I can see no effect like you have described.

Please provide the document and a sample code, so that we could reproduce the problem.

You’re right. This bug was on my end!

Looks like the problem happens when you set
CellFormat.VerticalAlignment = Center. The text becomes aligned
bottom-middle rather than left-middle. Why does this happen and
how do I set alignment to “left-middle”? Right now, it’s either
“bottom-left” or “bottom-middle”.



Thanks, Natan.

Basically, text alignment in the cell is defined by

CellFormat.VerticalAlignment property of the cell

and ParagraphFormat.Alignment property of the cell paragraphs.

To get what you want you need to play with those.