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.
Syncfusion Feedback

How can I get the count of cells in a range consisting of merged cells?

Thread ID:

Created:

Updated:

Platform:

Replies:

56868 Feb 21,2007 06:55 PM UTC Feb 26,2007 10:01 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: XlsIO
Emperor
Asked On February 21, 2007 06:55 PM UTC

Hi,
I am trying to access the cell next to a named range, and insert text in that cell. The range consists of merged cells. Please help me.
I tried using:
sheet.Range[row, col+1].Text = "Text"

But this does not insert any text in the cell next to sheet.Range[row, col+1].

Thanks!

Melba Winshia [Syncfusion]
Replied On February 22, 2007 02:03 PM UTC

Hi Emperor,

I am afraid. I created a sample with named range that contains Merged cells and inserted text to the next cell. But I was not able to reproduce the issue. Here is the test sample that I used to test this issue.

MergeCels.zip

Could you please take a look at the sample above and kindly let me know if you still find any problem, if not could you please modify this sample so that I can reproduce the issue. This would help me in investigating this issue further.

Thanks,
Melba

Administrator [Syncfusion]
Replied On February 23, 2007 02:41 PM UTC

Hello Melba,
Thanks for your response. I looked at the code that you sent, but in your code, you are doing a merge on rows and not columns. I am merging columns within the same row. As such doing column+1 works in your case. I am merging 5 columns within the row, so if I do column+5 it will work, but I dont want to hardcode "5" in the code.
I hope I made my situation more clear.

Thanks
Gautam



>Hi Emperor,

I am afraid. I created a sample with named range that contains Merged cells and inserted text to the next cell. But I was not able to reproduce the issue. Here is the test sample that I used to test this issue.

MergeCels.zip

Could you please take a look at the sample above and kindly let me know if you still find any problem, if not could you please modify this sample so that I can reproduce the issue. This would help me in investigating this issue further.

Thanks,
Melba

Melba Winshia [Syncfusion]
Replied On February 26, 2007 10:01 AM UTC

Hi Emperor,

You can use sheet.Range[row,column,lastrow,lastcol].Merge() to merge 5 columns within the same row and instead of using column+5 you can use lastcol+1 to insert text. Please refer the following code snippet which illustrates the above:

[C#]

int row=1;
int column=1;
int lastrow=1;
int lastcol=5;

// Merging cells (5 columns)
sheet.Range[row,column,lastrow,lastcol].Merge();

//Insert data
sheet.Range[row,lastcol+1].Text="Inserted Successfully";

Please refer the following sample which implements the above said feature:

MergeCels.zip

Kindly take a look and let me know if it meets your need.

Thanks,
Melba

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.

Warning Icon 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.Close Icon

;