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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

InserColumn to empty Worksheet

Thread ID:

Created:

Updated:

Platform:

Replies:

88644 Aug 5,2009 08:21 AM UTC Aug 5,2009 11:51 AM UTC WinForms 1
loading
Tags: XlsIO
Jakub Kurek
Asked On August 5, 2009 08:21 AM UTC

I have an issue concerning IWorksheet.InsertColumn method.

When I use it on a non-empty Worksheet (for example filled by ImportDataView, it works just fine.

However, when I try to create a Worksheet from scratch, it does not seem to work as I expect it to.


ExcelEngine eng = new ExcelEngine();
IApplication app = eng.Excel;
app.DefaultVersion = ExcelVersion.Excel97to2003;
IWorkbook workbook = app.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.InsertColumn(1);


If I use InsertColumn(0), I get an exception "Value cannot be less 1 and greater than max column index".

If I use InsertColumn(1), I don't seem to get any result (the number of columns is still 0 afterwards).

What am I doing wrong?

Geetha M [Syncfusion]
Replied On August 5, 2009 11:51 AM UTC

Hi Jakub,

Thank you for your interest in Syncfusion products.

InsertColumn is designed to work if the column index falls within the UsedRange of the sheet. In other words, a new column can be inserted only within the UsedRange, otherwise, a new cell must be added. This is why the existing sheet works and a new worksheet created from scratch does not show any effect. Also, the InsertColumn method takes input in one based index, and hence to insert a column at "A", you must use sheet.InsertColumn(1);

Please try this and let me know if you have any questions.

Regards,
Geetha

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

;