jQuery ooxml.Workbook.sheets merge without range name

0 Answers 96 Views
Grid Spreadsheet
Alden
Top achievements
Rank 1
Alden asked on 06 Feb 2023, 10:32 PM

Note that this is Workbook.sheets and not Spreadsheet, but I couldn't select a more relevant tag nor create my own.

I am having an issue merging cells that are in an existing sheet in a workbook. My attempt to use mergedCells after the sheet has been created has a roadblock, I can't seem to get the range name in string format as documented for the mergedCells option in Workbook.sheet:

mergedCells: ["A6:A8"]

I have the logic to determine which cells' indexes I want to merge, but only the indexes. I can't figure out a way to get the range in an Excel cell name. In the following example, ignoring how I got the index values, I can't merge the cells based on index where indexA is the column and indexB1 and indexB2 are rows.

let indexA = 0;

let indexB1 = 5;

let indexB2 = 7;

sheet.mergedCells = [[{indexA, indexB1},{indexA,indexB2}]]

I have attached a picture of the types of cells I want to merge, my loop first hits A6 through A8 and determines the indexes are to be merged because all the cells' values equal "Boat". Any help is appreciated, and I will try to provide more detail if needed, but it is difficult to provide much more because of the nature of the system I am on.

Thanks in advance.

Anton Mironov
Telerik team
commented on 09 Feb 2023, 03:06 PM

Hi Alden,

Thank you for the image, code snippets, and details provided.

Yes, you are totally correct - the "mergedcells" is a perfect choice. The method is working only with the described parameters, so you have to pass it in the format "["A1:D1"]".

Here is an example:

I hope this information helps. Let me know if further assistance is needed.

Kind Regards,
Anton Mironov

Alden
Top achievements
Rank 1
commented on 09 Feb 2023, 03:33 PM

According to the documentation, there doesn't seem to be a way to convert the indexes to the describer parameters. Are there plans to make it possible to either convert the index to that type of parameter or allow mergedCells to accept parameters?
Anton Mironov
Telerik team
commented on 14 Feb 2023, 12:23 PM

Hi Alden,

The parameters should be passed as for an excel file and the pointed syntax is required. The input indexes could be transferred to target the needed cells and then with string concatenation to create the result format.

Let me know if an example is needed for the described scenario and I will try my best to prepare an example.

Best Regards,
Anton Mironov

 

No answers yet. Maybe you can help?

Tags
Grid Spreadsheet
Asked by
Alden
Top achievements
Rank 1
Share this question
or