We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Slides MergeCells gives a System.NullReferenceException

Hi,

I am having an issue merging Table cells in the Aspose Slides for .NET version 15.1.0. I am using .Net Framework 4.

In the attached sample code I have 2 scenarios.

The first one gives a System.NullReferenceException in the last call to table.MergeCells in the last iteration of the loop.

Table table = GetFirstTableInSlide(presentationEx.Slides[0]);

// Work backwards last column through first column since going first to last did not work
int index = table.Columns.Count;

for (int colIndex = index - 1; colIndex >= 0; colIndex–)
{
IColumn column = table.Columns[colIndex];

// go in order bottom up merging cells vertically
ICell cell5 = column[5];
ICell cell6 = column[6];
table.MergeCells(cell5, cell6, true);

ICell cell3 = column[3];
ICell cell4 = column[4];
table.MergeCells(cell3, cell4, true);

ICell cell2 = column[2];
cell3 = column[3];
table.MergeCells(cell2, cell3, true);
}

In the second scenario, there is no run time error, but the rendered slide does not display. It just shows a gray blank slide.

Table table = GetFirstTableInSlide(presentationEx.Slides[0]);

// Work backwards last column through first column since going first to last did not work
int index = table.Columns.Count;

for (int colIndex = index - 1; colIndex >= 0; colIndex–)
{
IColumn column = table.Columns[colIndex];

ICell cell5 = column[5];
ICell cell6 = column[6];
table.MergeCells(cell5, cell6, true);
}
Thank you for your help.

Hi Ana,

Thanks for inquiring Aspose.Slides.

I have worked with the sample project shared by you and have been able to observe the issue while merging the column cells. It seems to be an issue and I have created an issue with ID SLIDESNET-36235 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.
During my investigation, I have also observed that if you merge the cells from left to right column order and merge till index 2 instead of index 3 (that is for column 4), all the cells are in table are merged as desired without any issue. I have shared the workaround sample that you can replace on your end for the time being to serve the purpose.

for (int colIndex = 0; colIndex < index - 1; colIndex++)


Many Thanks,

Hi Ana,

I have verified the application shared by you using Aspose.Slides for .NET 15.4.0 on my end and have not been able to reproduce the issue any further. I request you to please try using the specified version on your end as well and share your kind feedback with us in this regard.

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-36235) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.