We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to apply rotation to cells

Hi,

I want the final output like this. Cell_rotation.pdf (2.0 KB)

I tried the below code snippet to apply the rotation to text fragment but it does not look proper for 90 or 270 degree rotation. It does look properly rotated for 45 degrees.

private static void rotateCell() {
	//Add page to PDF object
	Page page = document.getPages().add();
	// rotate text
	TextFragment fragment = new TextFragment("rotated text");
	fragment.getTextState().setRotation(90);
	//create a table object
	Table table1 = new Table();
	//Specify the columns width information for table object
	table1.setColumnWidths("200 200");
	//Add Paragraph
	page.getParagraphs().add(table1);
	Row row2 = table1.getRows().add();
	Cell cell1Row2 = row2.getCells().add();
	cell1Row2.getParagraphs().add(fragment);
	// Save the resultant PDF document
	document.save("E:\\Pdfs\\AsposeTests\\Rotation_Output.pdf");
}

This is output of above code snippet - Rotation_Output.pdf (2.0 KB)

@BALKRUSHNA015478

I request you to try to set minimum row height with below code and share your feedback.

row2.setMinRowHeight(200);