Table CSS margin settings are ignored when converting from HTML to PDF

When converting from HTML to PDF with Aspose.Word for Java v24.10 table margins defined for CSS are ignored. I can reproduce this using the online converter at https://products.aspose.app/words/conversion/html-to-pdf as well.

Given the following HTML file…

<!DOCTYPE html>
<html>
	<head>
		<title>
			Table margins
		</title>
		<style>
		table { 
			margin: 10px auto;
			border: 1px solid #000000;
			width:100%;
		}
		</style>
	</head>
	<body>
		<table>
			<tbody>
				<tr>
					<td>
						A table with one cell
					</td>
				</tr>
			</tbody>
		</table>
		<table>
			<tbody>
				<tr>
					<td>
						A table with one cell
					</td>
				</tr>
			</tbody>
		</table>
		<table>
			<tbody>
				<tr>
					<td>
						A table with one cell
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>

Here is a screenshot showing the file as displayed in Chrome and the resulting PDF when converting with Aspose.Word…


MarginCSSBug.jpg (102.4 KB)

This topic has been moved to the related forum: Table CSS margin settings are ignored when converting from HTML to PDF - Free Support Forum - aspose.com