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

Vertically Merging on Tables Causes Incorrect Cell References #564

Closed
mcxbe opened this issue Aug 8, 2023 · 7 comments
Closed

Vertically Merging on Tables Causes Incorrect Cell References #564

mcxbe opened this issue Aug 8, 2023 · 7 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@mcxbe
Copy link

mcxbe commented Aug 8, 2023

When attempting to vertically merge cells in a table, certain merges cause the ATableCell backing field to point to the wrong cell.

To reproduce:

class Program
{
    static void Main(string[] args)
    {
        var presentation = SCPresentation.Create();
        var slide = presentation.Slides[0];

        var table = slide.Shapes.AddTable(0, 0, 4, 2);
        table.MergeCells(table[1, 3], table[0,3]);
        table[1, 1].Fill.SetColor("00FF00");

        presentation.SaveAs("test.pptx");
    }
}

In this code I create a 2 row by 4 column table. I then merge the right-most cells into a single column. Then I attempt to set the fill of cell[1,1] to green, however cell [0,1] changes instead. Also note that table[1,1] == table[0,1] becomes true.

@ashahabov ashahabov added the 🐛 bug Something isn't working label Aug 9, 2023
@ashahabov
Copy link
Member

@mcxbe, check this fix v0.47.1-beta.2

@mcxbe
Copy link
Author

mcxbe commented Aug 10, 2023

Looks like the above issue is fixed however there still some issues with table merging unfortunately. Take this case for example:

class Program
{
    static void Main(string[] args)
    {
        // opens presentation from the file path
        var presentation = SCPresentation.Create();
        var slide = presentation.Slides[0];

        var table = slide.Shapes.AddTable(0, 0, 4, 2);
        table.MergeCells(table[0, 0], table[0, 1]);
        table.MergeCells(table[1, 1], table[1, 2]);

        presentation.SaveAs("test.pptx");
    }
}

The result should be a 2 row x 3 column table, with cells 0 and 1 being merged on the first row, and cells 1 and 2 being merged on the second row, however the first row of the table ends up with only two cells (cells 0, 1 and 2 merged).

Sorry for these weird cases!

@ashahabov
Copy link
Member

@mcxbe, you do a good job with the quality bug report👍 Thank you.

I will take a look later.

@ashahabov
Copy link
Member

@mcxbe, check this v0.47.1-beta.3

@ashahabov ashahabov self-assigned this Aug 13, 2023
@mcxbe
Copy link
Author

mcxbe commented Aug 14, 2023

I have another one for you sorry!

class Program
{
    static void Main(string[] args)
    {
        var presentation = SCPresentation.Create();
        var slide = presentation.Slides[0];

        var table = slide.Shapes.AddTable(0, 0, 4, 2);
        table.MergeCells(table[0, 1], table[1, 1]);

        presentation.SaveAs("test.pptx");
    }
}

This one should simply merge the 2nd column vertically, however the 3rd column also gets merged. This behaviour is the same for any column your try to merge, other than the first column.

@ashahabov
Copy link
Member

@mcxbe, check this v0.47.1-beta.4

@mcxbe
Copy link
Author

mcxbe commented Sep 26, 2023

Hi @ashahabov. Sorry for the late response, I've been away. Had a reasonable play with version 0.48 and can't see any remaining issues. Thanks for your help, I will close this issue.

@mcxbe mcxbe closed this as completed Sep 26, 2023
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
None yet
Development

No branches or pull requests

2 participants