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.

sheet.FirstVisibleColumn

Thread ID:

Created:

Updated:

Platform:

Replies:

90414 Sep 30,2009 05:54 AM Oct 8,2009 02:07 AM ASP.NET Web Forms (Classic) 3
loading
Tags: XlsIO
Erich Schneider
Asked On September 30, 2009 05:54 AM

Hi,

I import data from a datatable with 20 fields. The sheet should only show a range of the fields. So I use the commands:
sheet.FirstVisibleColumn = 2
sheet.LeftVisibleColumn = 8
but nothing happened.

When I create a PDF, with the same data the commands:
format.StartColumnIndex = 2
format.EndColumnIndex = 10
work fine. So what is the difference?

Thanks

Geetha M [Syncfusion]
Replied On October 2, 2009 02:53 AM

Hi Erich,

Thank you for your interest in Syncfusion products.

It is not possible to select data from the datatable to import. If you want to hide the columns before 2 and after 8, please refer to the code snippet given below:

List visible = new List();

// Add visible column index
for (int i = 2; i < 9; i++)
visible.Add(i);

int col = sheet.UsedRange.LastColumn;
//Hide other column
for (int i = 1; i < col + 1; i++)
{
if(!visible.Contains(i))
sheet.ShowColumn(i, false);
}

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

Regards,
Geetha

Erich Schneider
Replied On October 5, 2009 09:34 AM

Hi Geetha,

can you please explain me the usage of sheet.FirstVisibleColumn. I can't understand the difference to the PDF-Funnction StartColumnIndex.

Here my VB-Code of both

PDF:
ta.Fill(dataTable, kurzzeichen, kurzzeichen,
p_jahrLabel.Text, p_monatLabel.Text, Profile.mandid,
Profile.periid, False, Profile.benutzer)

table.DataSource = dataTable

format.StartColumnIndex = 2
format.EndColumnIndex = 10

table.Draw(page, rect, format)

XlsIO:
ta.Fill(dataTable, p_kurzvonLabel.Text, p_kurzbisLabel.Text,
p_jahrLabel.Text, p_monatLabel.Text, Profile.mandid,
Profile.periid, False, Profile.benutzer)

sheet.ImportDataTable(dataTable, True, 1, 1)
sheet.FirstVisibleColumn = 2
sheet.LeftVisibleColumn = 8



When I use
sheet.ShowColumn(1, False)
sheet.ShowColumn(11, False)
sheet.ShowColumn(12, False)
the columns are hidden, but still there.

Thanks




Geetha M [Syncfusion]
Replied On October 8, 2009 02:07 AM

Hi Erich,

FirstVisibleColumn and LeftVisibleColumn are used to Select / Highlight a cell in the worksheet. You may check our class reference in the link below which could give you more details.

IWorksheet Members

As you said, the column can be show / hide using the ShowColumn method. If you do not want the data in the sheet and like to delete them permanently, you may make use of sheet.DeleteColumn() method.

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.

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.

;