当我在用户端尝试 exe 时,我遇到了这个问题。用户有 MicosoftExcel 2000,我有 execel 2003。有人可以帮助我吗?
我在 c# 中创建了这个工具并使用了 COM
if( strDataSheetFile.Trim().EndsWith( ".xls" ) || strDataSheetFile.Trim().EndsWith( ".xlsx" ) )
{
System.IO.StreamWriter file = null;
if (IfAbFile)
{
file = new System.IO.StreamWriter(AbaqusDeckFile.ToString(), true);
}
else
{
string[] strFILEnamesSplit = strDataSheetFile.Split(new Char[] { '\\' });
string ExpFile = "";
int ilnt = 0;
foreach (string strVal in strFILEnamesSplit )
{
if (ilnt < (strFILEnamesSplit.Length - 1))
{
ExpFile += strVal;
ExpFile += "/";
}
else
ExpFile += "Deck.inp";
ilnt += 1;
}
file = new System.IO.StreamWriter(ExpFile.ToString(), true);
}
List<List<double>> List_SheetValues = new List<List<double>>();
Excel.Application objexcel;
Excel.Workbook wbexcel;
Excel.Worksheet wsheet;
objexcel = new Excel.Application();
//strDataSheetFile = @"C:\Ajoy\Demos\IsoMount\IsoMount_Springs_database_updated.xls";
if (File.Exists(strDataSheetFile))
wbexcel = objexcel.Workbooks.Open(strDataSheetFile);
else
{
MessageBox.Show(" Please state the number of springs", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.UseWaitCursor = false;
return;
}