We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Cell width after ApplyHorizontalMerge

Thread ID:

Created:

Updated:

Platform:

Replies:

132460 Sep 3,2017 04:04 PM Sep 6,2017 12:40 AM Windows Forms 3
loading
Tags: DocIO
Riccardo Dozzo
Asked On September 3, 2017 04:04 PM

Hi
Product DocIO, v15.3.0.29

Say you have a table with 2 columns; for some rows, there is a call to ApplyHorizontalMerge.
So far, everything's fine.

In each row, I add an image to the cells in that row, scaling the image if necessary, comparing cell.Width to the width of the image (see sample code)

      var image = (WPicture) para.AppendPicture(File.ReadAllBytes(filename));
      var w = cell.Width;
      if (image.Width > w) {
      ...     
    
As long as the cell have not been merged, everything is fine, but for merged cells, cell.Width returns the initial width of the cell, not the one resulting after adiacent cells in that row were merged.

I've seen there are two properties, CellStartPosition and CellEndPosition, but they're internal, so they're not available.

Is there a way to get the final width of a cell resulting from merging more cells horizontally?

TIA

Sethumanikkam Yogendran [Syncfusion]
Replied On September 4, 2017 07:52 AM

Hi Riccardo,

Thank you for contacting Syncfusion support.

Is there a way to get the final width of a cell resulting from merging more cells horizontally?
Currently it’s not possible to get the final width of merged cells from particular cell. But, you can get the final width of cell by getting sum of merged cells width. We have prepared a sample to meet your requirement and in this sample, we have done the following.

     1. Created Word document and added table with 3 rows and 2 columns.
     2. Horizontal merge applied to second row.
     3. Inserted image in each cell and resized width of image by comparing with final width of cell.

Please find the sample from below which illustrates the same, and let us know if this helps you.

Sample link:
http://www.syncfusion.com/downloads/support/forum/132460/ze/Sample-F132460--604983782.zip
Note: Kindly refer the input used and output document inside the sample application.

If we misunderstood any of your requirement, then kindly provide us your sample or modified above sample and screenshot/output Word document of the expected result along with input if any which will be helpful for us to provide you the appropriate solution at the earliest.

Please let us know if you have any other questions.

Regards,
Sethumanikkam.Y


Riccardo Dozzo
Replied On September 5, 2017 05:16 PM

Thanks, that sample solved my problem.

To get a general solution, I've created 3 extension methods for WTableCell, based on your sample, to get actual width and the index of the first and last column in merge set for merged column.

Cheers



Sethumanikkam Yogendran [Syncfusion]
Replied On September 6, 2017 12:40 AM

Hi Riccardo,

Thank you for your update.

We are happy to hear that the provided sample resolved your requirement. Please let us know if you need any further assistance on this. We will be happy to assist you as always.

Please let us know if you have any other questions.

Regards,
Sethumanikkam.Y


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;