Free Support Forum - aspose.com

QueryTabls

Do you support QueryTabls

Hi,


Yes, Aspose.Cells does support query tables. You may adjust the columns width and preserve formattings atc.

If you have any confusion, let us know with details and provide sample Excel files and screen shots to show what are your needs. We will help you soon.

Thank you.

We load data using the following code. Can I do something like this. sqlQuery is the actual SQL that is used.

public void DisplayInExcel(_Worksheet displaySheet, string server, string database, string sqlQuery,

string position)

{

QueryTables mObjQryTables = null;

_QueryTable mObjQryTable = null;

mObjQryTables = displaySheet.QueryTables;

mObjQryTable = mObjQryTables.Add(

"ODBC;DRIVER=SQL Server;SERVER=" + server +

";UID=Sanjiv.Kondathodiyil;APP=Microsoft Office 2003;WSID=BERNIE;DATABASE=" + database +

";Trusted_Connection=Yes",

displaySheet.get_Range(position, Type.Missing),

sqlQuery);

mObjQryTable.RefreshStyle = XlCellInsertionMode.xlInsertEntireRows;

mObjQryTable.Refresh(false);

}

Hi,


Well, I am afraid you cannot add QueryTables in the worksheet to directly fetch data from your data source. Instead we provide some valuable methods for Cells class and you may import data from DataTable, DataSet, Array, ArrayList and other objects to fill the worksheet cells. All you need to do is use your .NET APIs (e.g ADO.NET APIs) to fill data to a data table/dataset or array etc., then use the Importing data options provided by Aspose.Cells to fetch data to fill the worksheet cells. See the document for your complete reference:
http://www.aspose.com/docs/display/cellsnet/Importing+Data+to+Worksheets

Thank you.