Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

"Expected Unit" when assigning column width on InDesign Server 2015

Explorer ,
Jul 27, 2016 Jul 27, 2016

I'm currently transferring my InDesign scripts to run on InDesign Server 2015, so far everything worked fine, until now.

When I try to assign a width to a column, I receive the following error:

Error String: Invalid value for set property 'width'. Expected Unit, but received "1.058mm".

The code looks like this (listTable is my table object and iEigCol a counter within a for loop, so nothing out of the ordinary):

var spacerColumnWidth = 1.058;

listTable.columns[iEigCol].width = spacerColumnWidth + 'mm';

A few lines earlier I'm using this:

listTable.columns[0].width = '82mm';

Which works just fine.

I already tried these approaches instead:

  • Using just the number without the unit
  • Using an integer instead of a double
  • Concatenating the string before using it to assign the width
  • Using a literal string

so far nothing worked here. Strange thing is, that it works on dozens of other columns with any of the mentioned ways to do it.

The exact same script also works fine in InDesign CS5.5.

Any ideas what the problem might be?

Thanks a lot!

TOPICS
Scripting
979
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jul 27, 2016 Jul 27, 2016

InDesign does not let you define a table column width or row height under 1.058mm (even not in scripting). And in scripting, it does not let you define under 1.059mm. Try to work with 1.059mm, and it should work.

Translate
Community Expert ,
Jul 27, 2016 Jul 27, 2016

If I remember that right, a minimum value for table cell's width was "introduced" with (perhaps) CC 2014 as we always had it with the UI of InDesign but not with ExtendScript scripting.

Filed a bug report on this that was dismissed.

Not only InDesign Server is affected, also the desktop products.

Regards,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2016 Jul 27, 2016

Laubender wrote:

If I remember that right, a minimum value for table cell's width was "introduced" with (perhaps) CC 2014 as we always had it with the UI of InDesign but not with ExtendScript scripting.

I was wrong with CC 2014. It was CS6 v8.0.2 where that was changed.

See this thread and a possible workaround using an edited IDMS file of the table:

I need to force column widths to values smaller than the indesign preset minimuns (1,058mm).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 27, 2016 Jul 27, 2016

InDesign does not let you define a table column width or row height under 1.058mm (even not in scripting). And in scripting, it does not let you define under 1.059mm. Try to work with 1.059mm, and it should work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2016 Jul 27, 2016

AriEss wrote:

InDesign does not let you define a table column width or row height under 1.058mm (even not in scripting). And in scripting, it does not let you define under 1.059mm. Try to work with 1.059mm, and it should work.

At least on the height I can proof a height under 1.058 mm by scripting.

1. Set topInset and bottomInset of all cells in a row to value 0

2. Set the pointSize of texts[0] of every cell in a row to value 0.1 or less

3. Apply the height. E.g. "0.5 mm"

See this screenshot from InDesign CC v9.3.0 (also tested with CC 2014.2) where I selected and changed the height of the cells of the second row in the table to 0.5 mm:

HeightOfTableRowCells-0.5mm.png

However, doing the width of a column with less than 1.059 mm is not possible by scripting the DOM with CS6 and above. Editing IDML or editing IDMS and placing the table will result in widths less than 1.059 mm.

Regards,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 28, 2016 Jul 28, 2016

Laubender schrieb:

At least on the height I can proof a height under 1.058 mm by scripting.

Can confirm that, I used that to hide some dummy rows. I haven't checked though if they actually are that small, since they were not set to a visible color, but so far no one complained

Anyway, 1.059mm worked, so I'm using that, 0.001 additional millimeters won't do much harm.

Thanks a lot!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 28, 2016 Jul 28, 2016

The "tragic" with decreasing the height of a cell below the minimum height that is available with the UI is, that a customer, who is changing that to a different value cannot go back other than undoing all actions after the point that he/she was using different values.

I never understood why there must be a minimum height or a minimum width* at all.
If doing so by editing IDMS or IDML files the document will work as expected* and is not going unstable.

* With a width below the values the UI is supporting, it could be, that the width will snap back to 1.058 mm depending of the version of InDesign one is using.

The developers should drop that barrier at all and should allow 0 as the absolute minimum for the height and width of cells (rows/columns). Obviously there are use cases in real world layouts. It's time to do another feature request with some strong use cases.

Maybe here is the place to assemble them.

So, can you tell me more about your "dummy row" use case?

My first use case would be a script, that simply can hide rows and columns by setting the width or the height to zero.
That would come handy for large tables where the user can benefit from a quick access of a particular row or a particular column.

Another case:

The maximum number of columns allowed: 200

Sometimes I have to work with tables with more than 200 columns.

One can create such a thing with the UI of InDesign with a trick, but IDML will not support it.
Opening an IDML with a table of more than 200 columns will create a document without a table.

Already reported this as bug.

Thanks,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 29, 2016 Jul 29, 2016

I don't see a reason for the width restriction as well and also can see some use cases for columns with less than 1mm width.

The dummy row case occurred, when I had to merge cells in the first row and that was the only row of the table, since the other rows were added later. In that case, InDesign reduced the column count of the table to the number of cells in that row and new rows could no longer be unmerged. So I kept an additional row with the original column count, then later rows could be unmerged again. I started to delete that row in more recent scripts, but keeping it at a minimum height still helps, since I also check if the table still fits for each row that is added, so if it takes up less space, that still helps.

Also good to know about the 200 column limit. I'm not sure if we will ever crack that, but we just started tables where three columns are needed for each value, so we would only need 67 values per row to get beyond 200.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 30, 2016 Jul 30, 2016
LATEST

mechaichezilla wrote:

… Also good to know about the 200 column limit. I'm not sure if we will ever crack that, but we just started tables where three columns are needed for each value, so we would only need 67 values per row to get beyond 200.

The fascinating thing with the IDML bug with a table of more than 200 columns is, that InDesign CS4 can open an IDML with a table of 201 plus more columns without problems.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 27, 2016 Jul 27, 2016

try to define units first..

app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS; 

app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS; 

then no need to use 'mm', so the coding like

var spacerColumnWidth = 1.058

listTable.columns[iEigCol].width = spacerColumnWidth

listTable.columns[0].width = 82

also keep mind what AriEss said.. the values i am not sure

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines