C# align text to right in column

Hi,

I have a code for removing table borders.
A also have to align text to right in right column.

Here is the code:

try
{
var wordApplication = new Microsoft.Office.Interop.Word.Application() { Visible = true };
var myDocument = wordApplication.Documents.Open(in_FilePath);

Microsoft.Office.Interop.Word.Table finalReportTables = myDocument.Tables.Cast<Microsoft.Office.Interop.Word.Table>().ToArray();
Microsoft.Office.Interop.Word.Table firstTable = finalReportTables.First();

myDocument.Save();
wordApplication.Quit();
}
catch( Exception e)
{
Console.WriteLine(e.Source.ToString()+" “+e.Message.ToString()+” "+e.TargetSite.ToString());
}

Hi @markosc ,

I haven’t tested this but this doesn’t throw any compilation error. So can you check if this works -
firstTable.Rows.Alignment=Microsoft.Office.Interop.Word.WdRowAlignment.wdAlignRowRight

Picking cues from this - How to align MSWord Table as center using C# code

Let me know if this helps

Thanks,
Nishant

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.