Rotating text inside table using aspose.words

Dear all ,

I was trying to rotate the text inside html table using aspose.words dll (to get an output like image2.png)

but the text is not being rotated :S
this is the code used :

string dataDir = @"D:\Data\desktop";
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

String test = "<table><tr><tc>10kg</tc></tr></table>";
builder.InsertHtml("" + test + "");

And this is the css for class rotate :

.rotate {
background-color:lightgrey;
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083); /* IE6,IE7 */*
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)"; / IE8 */*
-moz-transform: rotate(-90.0deg); / FF3.5+ */*
-ms-transform: rotate(-90.0deg); / IE9+ */*
-o-transform: rotate(-90.0deg); / Opera 10.5 */*
-webkit-transform: rotate(-90.0deg); / Safari 3.1+, Chrome */*
transform: rotate(-90.0deg); / Standard */
}

Best ,

Hi Kamel,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your html to Word document using MS Word, you will get the same output.

In your case, I suggest you please use the CellFormat.Orientation property after inserting the html into the document to achieve your requirements. Please check the following code example for your kind reference. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(File.ReadAllText(MyDir + "in.html"));
Table table1 = (Table)doc.GetChild(NodeType.Table, 0, true);
table1.FirstRow.FirstCell.CellFormat.Orientation = TextOrientation.Upward;
// Insert second table.
Table table = builder.StartTable();
// Insert a cell
builder.InsertCell();
// Use fixed column widths.
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
builder.Write("This is row 1 cell 1");
// Insert a cell
builder.InsertCell();
builder.Write("This is row 1 cell 2");
builder.EndRow();
// Insert a cell
builder.InsertCell();
// Apply new row formatting
builder.RowFormat.Height = 100;
builder.RowFormat.HeightRule = HeightRule.Exactly;
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(MyDir + "Out.docx");