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

Javascript | How to know if a cell is merged in a table?

Explorer ,
Aug 13, 2020 Aug 13, 2020

Hi,

 

I'm currently working on a script that applies a background color to a column.

With simple table it works fine, but when on the first rown there is two cells merged, and if I select the merged cells and the two columns below, it only colors the first one.

 

I thought that if I knew if the selected cell is a merged cell, I could easily color the selected column.

 

Many thanks,

Nicolas

TOPICS
Scripting
1.4K
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

Community Expert , Aug 13, 2020 Aug 13, 2020

columnSpan is for horizontal merges, rowSpan for vertical, so best check both (http://jongware.mit.edu/idcs5.5js_html/idcs5.5js/pc_Cell.html)

Translate
Community Expert ,
Aug 13, 2020 Aug 13, 2020

If a cell's rowSpan is greater than 1 it's horizontally merged.

if (myCell.rowSpan > 1)

P.

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 ,
Aug 13, 2020 Aug 13, 2020

columnSpan is for horizontal merges, rowSpan for vertical, so best check both (http://jongware.mit.edu/idcs5.5js_html/idcs5.5js/pc_Cell.html)

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 ,
Aug 13, 2020 Aug 13, 2020

Wow, thanks to both of you, that's exactly what I needed!

Have a nice day 🙂

 

Nicolas

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 ,
Mar 27, 2023 Mar 27, 2023

FYI, the link is broken!

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 ,
Mar 27, 2023 Mar 27, 2023
LATEST

Here is an alternate link for the same

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Cell.html

-Manan

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