CellVerticalAlignment.Bottom

In VB I have tried using set the vertical alignment to the bottom.

builder.InsertCell()
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Bottom
builder.CellFormat.Width = 200

But it does not seem to have any effect. What do I need to do?
Thanls

How can I align the text in a cell to the bottom? I’m using …

builder.InsertCell()
builder.RowFormat.Height = 15
builder.RowFormat.Alignment = RowAlignment.Center|
builder.RowFormat.LeftIndent = 50
builder.CellFormat.Width = 75
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Bottom
builder.CellFormat.Borders.LineStyle = LineStyle.Single
builder.CellFormat.Borders.LineWidth = 1
builder.Writeln("Program Code")

But it does not seem to work
Thanks

Hi
Thanks for your inquiry. Please try using the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.StartTable();
// Insert a cell
builder.InsertCell();
builder.RowFormat.Height = 500;
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Top;
builder.Writeln("This is row 1 cell 1");
// Insert a cell
builder.InsertCell();
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Bottom;
builder.Writeln("This is row 1 cell 2");
builder.EndRow();
// Apply new row formatting
builder.RowFormat.Height = 100;
builder.RowFormat.HeightRule = HeightRule.Exactly;
// Insert a cell
builder.InsertCell();
builder.CellFormat.Orientation = TextOrientation.Upward;
builder.Writeln("This is row 2 cell 1");
// Insert a cell
builder.InsertCell();
builder.CellFormat.Orientation = TextOrientation.Downward;
builder.Writeln("This is row 2 cell 2");
builder.EndRow();
builder.EndTable();
doc.Save("out.doc");

Best regards,

Sorry Don’t see it. I put borders around the cells so I can see the effects
Below is my entire code
I can comment out the last two

builder.CellFormat.Orientation = TextOrientation.Upward
builder.CellFormat.Orientation = TextOrientation.Downward

And nothing changes
As you can see in the cells both cells on each line are the same
Line This is row 1 cell 2 Has

builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Bottom

but it only changes the next row
I know I must be missing something
Thanks

Public Function TestDoc() As MemoryStream 
Dim ms As New MemoryStream Dim license As Aspose.Words.License = New Aspose.Words.License
license.SetLicense("Aspose.Words.lic")
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.StartTable()
builder.CellFormat.Borders.LineStyle = LineStyle.Single
builder.CellFormat.Borders.LineWidth = 1
builder.InsertCell()
builder.RowFormat.Height = 500
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Top
builder.Writeln("This is row 1 cell 1")
builder.InsertCell()
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Bottom
builder.Writeln("This is row 1 cell 2")
builder.EndRow()
builder.RowFormat.Height = 100
builder.RowFormat.HeightRule = HeightRule.Exactly
builder.InsertCell()
builder.CellFormat.Orientation = TextOrientation.Upward
builder.Writeln("This is row 2 cell 1")
builder.InsertCell()
builder.CellFormat.Orientation = TextOrientation.Downward
builder.Writeln("This is row 2 cell 2")
builder.EndRow()
builder.EndTable()
doc.Save(ms, Aspose.Words.SaveFormat.Rtf)

Return ms

Hi Bill,
Thanks for your inquiry.
Your code actually does set the vertical cell alignment of the top row correctly, its just that the cell itself it set to fit content and is too short to notice the affects of the alignment. If you increase the row height for that row in MS Word you will see that it is actually appearing correctly.
I have made some changes to your code above to ensure the output is generated correctly like this.

Dim doc As New Document()
Dim ms As New MemoryStream Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.StartTable()
builder.CellFormat.Borders.LineStyle = LineStyle.Single
builder.CellFormat.Borders.LineWidth = 1
builder.RowFormat.Height = 100
builder.RowFormat.HeightRule = HeightRule.Exactly
builder.InsertCell()
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center
builder.Writeln("This is row 1 cell 1")
builder.InsertCell()
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Bottom
builder.Writeln("This is row 1 cell 2")
builder.EndRow()
' Set alignment back to top again for next row
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Top
builder.InsertCell()
builder.Writeln("This is row 2 cell 1")
builder.InsertCell()
builder.Writeln("This is row 2 cell 2")
builder.EndRow()
builder.EndTable()
doc.Save(ms, Aspose.Words.SaveFormat.Rtf)

If you have any further queries, please feel free to ask.
Thanks,

Hi

Thank you for additional information. I think, in your case, you just should use Write method instead of Writeln.

builder.Write("This is row 2 cell 2")

In this case, there will not be an additional paragraph break at the end of each cell.
Best regards,

Write instead of Writeln was the solution
THANKS