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

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

Explorer ,
Aug 13, 2020 Aug 13, 2020

Copy link to clipboard

Copied

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

Views

839

Translate

Translate

Report

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)

Votes

Translate

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

Copy link to clipboard

Copied

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

if (myCell.rowSpan > 1)

P.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Have a nice day 🙂

 

Nicolas

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

FYI, the link is broken!

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

Here is an alternate link for the same

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

-Manan

Votes

Translate

Translate

Report

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