Author Topic: Questions about alignment and Excel merged-cell paste in pqGrid v11  (Read 2556 times)

luckduck

  • Pro OEM
  • Jr. Member
  • *
  • Posts: 60
    • View Profile
Hello,

I have two questions regarding pqGrid version 11:

1. In the colModel of pqGrid v11, when valign: "center" is set, the text is aligned to the left-middle.
Even if align: "center" is also set, the horizontal alignment remains left and does not change.
Is this the intended behavior in v11, or is it a bug?

2. In pqGrid v11, when pasting data copied from Excel that contains merged cells, the data is not pasted into the correct positions.
In versions up to pqGrid v10, even though merged cells were not preserved, the data was correctly inserted based on the merged cell’s reference position.
Has this behavior changed in v11?

Thank you.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Questions about alignment and Excel merged-cell paste in pqGrid v11
« Reply #1 on: February 09, 2026, 11:16:02 pm »
Thanks for your questions.

1) It's a bug

Please add this css to fix it
Code: [Select]
.pq-grid-cell > div{
flex-grow:1;
}

2. Could you please provide more details with an example.

luckduck

  • Pro OEM
  • Jr. Member
  • *
  • Posts: 60
    • View Profile
Re: Questions about alignment and Excel merged-cell paste in pqGrid v11
« Reply #2 on: February 10, 2026, 05:58:07 am »
"Please see the example below regarding question number 2."


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Questions about alignment and Excel merged-cell paste in pqGrid v11
« Reply #3 on: February 10, 2026, 11:16:23 pm »
Thank you for the details, I'm looking into it.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Questions about alignment and Excel merged-cell paste in pqGrid v11
« Reply #4 on: February 13, 2026, 09:54:16 am »
Please apply the following patch to resolve the merged-cells copy–paste issue until the next version is released.

Code: [Select]
pq.extractCells=function(t){let l=t.match(/<style>([\s\S]*?)<\/style>/),e=l?l[1].replace(/(<!--|-->)/,""):"",a={};e.replace(/\.([^\s{]+)\s*{([^}]*)}/g,((t,l,e)=>{a[l]=e.trim()}));let s=[];return[...t.matchAll(/<tr(.*?)>(.*?)<\/tr>/gs)].forEach(((t,l)=>{let e=t[2];s[l]||(s[l]=[]);let r=0;[...e.matchAll(/<td(.*?)>(.*?)<\/td>/gs)].forEach((t=>{for(;s[l][r];)r++;let e=t[1],c=t[2],n=e.match(/colspan=["']?(\d+)["']?/i),o=e.match(/rowspan=["']?(\d+)["']?/i),p=n?parseInt(n[1],10):1,h=o?parseInt(o[1],10):1,m=e.match(/style=(['"])(.*?)\1/),f=(m?.[2]||"").replace(/&quot;/g,'"'),y=e.match(/class=(["'])([^"'<>]+)\1|class=([^\s<>]+)/),i=y?y[2]||y[3]:null,u=i&&a[i]?a[i]:null,d=pq.parseStyle([f,u].join(";"));for(let t=0;t<h;t++)for(let e=0;e<p;e++){let a=l+t,n=r+e;s[a]||(s[a]=[]),s[a][n]=0===t&&0===e?{val:c,style:d}:{val:"",style:d}}r++}))})),s};

Include this snippet anywhere after the pqGrid JavaScript file.

Please let me know if you have any questions or need further assistance.

luckduck

  • Pro OEM
  • Jr. Member
  • *
  • Posts: 60
    • View Profile
Re: Questions about alignment and Excel merged-cell paste in pqGrid v11
« Reply #5 on: February 13, 2026, 11:50:53 am »
I've applied the code you provided, and I can confirm that both issues are now resolved. Thank you