Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version <= v0.13.1 Template merge row list rendering has no merge #207

Closed
shps951023 opened this issue Apr 19, 2021 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@shps951023
Copy link
Member

shps951023 commented Apr 19, 2021

image

@shps951023 shps951023 added the bug Something isn't working label Apr 19, 2021
@shps951023 shps951023 changed the title Template merge row list rendering has no merge v0.13.1 Template merge row list rendering has no merge Apr 19, 2021
@shps951023
Copy link
Member Author

image

@shps951023
Copy link
Member Author

How to solve this case :
image

@shps951023
Copy link
Member Author

Logic Code:

var mergecells = Queryfrom(""\xml\worksheets\sheet1.xml");

foreach(var row in rows)
{
    foreach(var c in row.cells)
    {
        var mergeCell = mergecells.SingleOrDefault(w=>w.r == c.R);
        if(mergeCell!=null)
        {
            foreach(var v in c.IEnumerable)
            {
                mergeCell.insert(newMergeCell);
            }        
        }
    }
}

RenderNewMergeCells();

@shps951023
Copy link
Member Author

shps951023 commented Apr 19, 2021

ClosedXml Report
image
image

input

    <mergeCells count="6">
        <mergeCell ref="D2:G4"/>
        <mergeCell ref="B2:C4"/>
        <mergeCell ref="B1:C1"/>
        <mergeCell ref="D1:G1"/>
        <mergeCell ref="B5:C5"/>
        <mergeCell ref="D5:G5"/>
    </mergeCells>

output

    <x:mergeCells count="6">
        <x:mergeCell ref="B1:C1" />
        <x:mergeCell ref="D1:G1" />
        <x:mergeCell ref="B2:C4" />
        <x:mergeCell ref="D2:G4" />
        <x:mergeCell ref="B5:C7" />
        <x:mergeCell ref="D5:G7" />
    </x:mergeCells>

image

@shps951023 shps951023 changed the title v0.13.1 Template merge row list rendering has no merge Version <= v0.13.1 Template merge row list rendering has no merge Apr 20, 2021
@shps951023
Copy link
Member Author

Mergecells can't be empty
image
image

@shps951023
Copy link
Member Author

shps951023 commented Apr 22, 2021

image
image
image
image

reason:

image

V0.13.3 fix :
image

@shps951023
Copy link
Member Author

shps951023 commented Apr 22, 2021

Last merge one don't add new row, or it'll get duplicate result like :
image
image

Fixed result:
image

@shps951023
Copy link
Member Author

v 0.13.4 fixed this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant