I'm looking for a solution to make the cell width fit to it's content due a script in Extendscript. anyone who can help me with this?
It's okay to change to resize the entire column. First I run this script to make sure every cell has just 1 line:
doc = app.activeDocument;
var table = doc.textFrames[0].tables[0]; //auto resize (beta)
for (var i = 0; i < table.columns.length; i++)
{
var column = table.columns[i];
for (var a = 0; a < column.cells.length; a++)
{
var cell = column.cells[a];
cell.contents = cell.contents.replace(/ |\s+/g, " ")
var lines = cell.lines.length;
while (lines > 1)
{
cell.width++;
lines = cell.lines.length;
}
}
}
But after that iI want to resize the column width to it's minimum width. When this is done I will make the table fit to the document.