这是我原来的代码但是这样导出的单元格太小了,
文字显示不全,想要单元格大一点怎么改呀,或者用别的什么方法写呀?
还有我如果想把第一行单元格的字体颜色设置成红色,该怎么写呀?
string sql1 = "select top 65535 ID into [Excel 8.0;database=" + filename + "].[单选] from 单选";
AccessDAO.getDataSetFromAccessTable(sql1,accessFilePath);
public static DataSet getDataSetFromAccessTable(string sql, string dataFilePath)
{
// 连接数据库
OleDbConnection connct = new OleDbConnection();
string oleDB = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dataFilePath;
connct.ConnectionString = oleDB;
OleDbCommand command = new OleDbCommand(sql, connct);
try
{
connct.Open();
DataSet dataSet = new DataSet();
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(command);
dataAdapter.Fill(dataSet);
connct.Close();
return dataSet;
}
catch (Exception ee)
{
MessageBox.Show(ee.Message.ToString(), "出错信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
finally
{
connct.Close();
}
}