# Determining the Width of a Table Cell

I was a bit confused by the documentation on this subject. If I’m calculating the width of a cell, would the equation be:

pdfCell.FitWidth = pdfCell.FitWidth - <padding_left> - <padding_right> - 2 * (<cell_border_width> + <row_border_width> + <table_border_width&gt My reasoning follows from your documentation stating that the row and table borders are overlapped. So the maximum width of a cell should subtract off twice the sum of all border widths (since borders are on both sides of a cell) as well as the left/right cell padding.

Dear cohenn,

Thank you for considering Aspose.

Please refer to ColumnWidthAndColumnsSpan. In this document, I want to explain how to put a image into a cell. The equation is
image.ImageInfo.FixWidth =
cellWidth - cellBorderWidth -

I have not consider table borders in this example. If there are table borders, the equation may like this:
image.ImageInfo.FixWidth =
cellWidth - cellBorderWidth/2 - Max(cellBorderWidth,tableBorderWidth)/2 -

That means, since cell border row border and table border are overlaped, only the one with max width is concerned.

Did you mean to type:

Max(rowBorderWidth, tableBorderWidth)/2

?

Dear cohenn,

Thank you for considering Aspose.

Sorry for not making it clear. This is only pseudocode used to explain my idea.

That’s fine. I just wanted to make sure you meant Max(rowBorder, tableBorder) instead of Max(cellBorder, tableBorder).

Dear cohenn,

Thank you for considering Aspose.

This is decided by which borders you used.

In that case, the equation would be:

image.ImageInfo.FixWidth =
cellWidth - cellBorderWidth/2 -
Max(cellBorderWidth, rowBorderWidth, tableBorderWidth)/2 -