Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Fala ai pessoal beleza?
Estou com um problema muito chato mas dever ser simples a resolução, procurei em vários lugares e não encontrei nada.
Tenho a seguinte classe( muito boa :D ):
Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet oSheet;
Excel.Range oRng;
//Start Excel and get Application object.
oXL = new Excel.Application();
oXL.Visible = true;
//Get a new workbook.
oWB = (Excel._Workbook)(oXL.Workbooks.Add(Missing.Value));
oSheet = (Excel._Worksheet)oWB.ActiveSheet;
int i, qtdcoluna;
qtdcoluna = tabela.Columns.Count;
for (i = 0; i <= qtdcoluna - 1; i++)
{
string namecolu = tabela.Columns[i].ColumnName;
oSheet.Cells[1, i + 1] = namecolu;
}
//Format A1:D1 as bold, vertical alignment = center.
oSheet.get_Range("A1", "XFD1").Font.Bold = true;
oSheet.get_Range("A1", "XFD1").VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
int numrows = tabela.Rows.Count;
// Create an array to multiple values at once.
int numvetor = numrows + 1;
string[,] saNames = new string[numvetor, NumeroMaxColuna];
for (int ic = 0; ic < NumeroMaxColuna; ic++)
{
for (int ir = 0; ir < numrows; ir++)
{
saNames[ir, ic] = tabela.Rows[ir][ic].ToString();
}
}
string maxvetor = LetraUltimaColuna + numvetor.ToString();
//Fill A2:B6 with an array of values (First and Last Names).
oSheet.get_Range("A2", maxvetor).Value2 = saNames;
//AutoFit columns A:D.
oRng = oSheet.get_Range("A1", LetraUltimaColuna+"1");
oRng.EntireColumn.AutoFit();
//Manipulate a variable number of columns for Quarterly Sales Data.
DisplayQuarterlySales(oSheet);
//Make sure Excel is visible and give the user control
//of Microsoft Excel's lifetime.
oXL.Visible = true;
oXL.UserControl = true;
}
private static void DisplayQuarterlySales(Microsoft.Office.Interop.Excel._Worksheet oSheet)
{
throw new NotImplementedException();
}
}
ela gerar os arquivo sem problema nenhum......
O problema é quando eu publico na web.... ai ele não gera mais............................
OBRIGADO PELA AJUDA... .
Carregando comentários...