Using specific columns in datareader or datatable

Hi,


Is there a way to import only a specific columns of a datatable or datareader to a worksheet using ImportDataReader/ DataTable?

Thanks!

This message was posted using Page2Forum from Cells.ImportDataReader Method (SqlDataReader, Boolean, Int32… - Aspose.Cells for .NET

Hi,

I think you may use ImportDataColumn() method to paste your desired column(s) from the DataTable. e.g

worksheet.Cells.ImportDataColumn(datatable1, false, 0,0, “Customer_Name”, false);

You can also use this method in a loop accordingly for your need.

Thank you.

Thanks Amjad!


Is there a way to lock a specific column? All other solutions in the forum use WebGrid or WebCells which isn’t compatible with what am using.

Thank you.

Hi,

See the document especially “Protect a Column in the Worksheet” in it for your reference:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/protecting-worksheets.html

thank you.