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

Free Support Forum - aspose.com

How to find a cell in table is merged or not

Hi

I have a table in word file and one of my cell in the table is merged cell,When am looping each cells in the table how can i find which cell is merged and how many cells merged with that single cell,i mean the count of the cells that are merged with that cell

Hi Ajeesh,


Thank you for inquiry. Please follow up the documentation to extract merge details of table cell.
http://docs.aspose.com/display/wordsnet/Working+with+Merged+Cells
I hope, this will help.

hi

Thanks for your reply.The above code is not working.Here by am attaching my word file.Can you please debug my word file.When am debuging always am getting VerticalMerge is NONE only.Can you please check my word file and tell me where i went wrong.I also want to know how many cells merged that particular cell

Hi Ajeesh,

Thanks for your inquiry. I am not able to see any attachments with this thread. Could you please attach input document along with code snippet.

HI

Here by am attaching my word file and adding my code also please look into it

public string PrintCellMergeType(Aspose.Words.Tables.Cell cell)

{

bool isHorizontallyMerged = cell.CellFormat.HorizontalMerge != Aspose.Words.Tables.CellMerge.None;

bool isVerticallyMerged = cell.CellFormat.VerticalMerge != Aspose.Words.Tables.CellMerge.None;

string cellLocation = string.Format("R{0}, C{1}", cell.ParentRow.ParentTable.IndexOf(cell.ParentRow) + 1, cell.ParentRow.IndexOf(cell) + 1);

if (isHorizontallyMerged && isVerticallyMerged)

return string.Format("The cell at {0} is both horizontally and vertically merged", cellLocation);

else if (isHorizontallyMerged)

return string.Format("The cell at {0} is horizontally merged.", cellLocation);

else if (isVerticallyMerged)

return string.Format("The cell at {0} is vertically merged", cellLocation);

else

return string.Format("The cell at {0} is not merged", cellLocation);

}

Hi Ajeesh,


Thank you for inquiry. After investigation, I can observe that the word document does not contain any merged cell. Moreover, while debugging you can observe cells count of each row which is not equal at all. I have attached a sample document, please try similar code with it.

I hope, this will help. In case of any ambiguity, please let me know.

Hi

Your template is working but if i put any value inside the merged cell then its not working

Hi Ajeesh,


Thank you for inquiry. While using latest Aspose.Words 11.1.0. I managed to reproduce this problem on my side. I have logged your issue as WORDSNET-6019 into our
bug tracking system. Your request has also been linked to the appropriate
issue. Once we sort it out, we will let you know. Sorry for inconvenience.

<o:p></o:p>


Hi there,


Thanks for your inquiry.

I’m afraid there is actually no bug here. Microsoft Word simply rewrites the table as having a wide
cell after save instead of several merged cells. You can see this if you open up the internal document.xml found inside the DOCX file. Therefore the value that is loaded into Aspose.Words is correct.

This behavior is a common occurrence and it’s hard to know when or why Microsoft Word chooses to save cells in this way. This topic is briefly discussed in the documentation here:
http://docs.aspose.com/display/wordsnet/Working+with+Merged+Cells

<o:p></o:p>

Could we ask why you need to find merged cells at all? Perhaps you could use bookmarks instead.


Thanks,

Hi

why am looking for merged cell is,i i got a class file which is used to convert word document into excel and its working fine except if i have merged cells in the word document its not displaying as merged cells in excell.Here by am attaching the class file.Please look the code and give me a solution

Hi Ajeesh,

Thanks for your inquiry.

Please refer to the answer that I replied in the following post:
http://www.aspose.com/community/forums/368009/merged-columns-not-displaying-as-merged-when-convert-from-word-to-excel/showthread.aspx#368009

The issues you have found earlier (filed as WORDSNET-6019) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.