si alguien conoce algun link con informacion referente se los agradeceria mucho.
saludos y gracias de antemano

| |||
![]() Hola Amigos alguien sabe como poder crear un documento excel con varias hojas dentro, con diferentes datos de una bd??? si alguien conoce algun link con informacion referente se los agradeceria mucho. saludos y gracias de antemano ![]() |
| |||
generar excel con varias hojas???? Hola amigos quisas es muy sencillo pero lo he buscado y no he encontrado nada de documentacion sobre como generar una planilla excel con varias hojas de calculo dentro, asignandole un nombre de hoja, y sus datos correspondientes, necesito generarlo en asp. sera factible crearlo sin necesidad de utilizar el objeto OWC??? saludos y gracias |
| |||
Hola amigos aqui encontre el codigo antes mensionado, exporta a excel sin problema, el tema es como puedo generar o darle el atributo de cambiar y crear nuevas hojas, y como decirle que dato tiene que guardar en alguna hoja que yo determine??? <% Option Explicit Class ExcelGen Private objSpreadsheet Private iColOffset Private iRowOffset Sub Class_Initialize() Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet") iRowOffset = 2 iColOffset = 2 End Sub Sub Class_Terminate() Set objSpreadsheet = Nothing 'Clean up End Sub Public Property Let ColumnOffset(iColOff) If iColOff > 0 then iColOffset = iColOff Else iColOffset = 2 End If End Property Public Property Let RowOffset(iRowOff) If iRowOff > 0 then iRowOffset = iRowOff Else iRowOffset = 2 End If End Property Sub GenerateWorksheet(objRS) 'Populates the Excel worksheet based on a Recordset's contents 'Start by displaying the titles If objRS.EOF then Exit Sub Dim objField, iCol, iRow iCol = iColOffset iRow = iRowOffset For Each objField in objRS.Fields objSpreadsheet.Cells(iRow, iCol).Value = objField.Name iCol = iCol + 1 Next 'objField 'Display all of the data Do While Not objRS.EOF iRow = iRow + 1 iCol = iColOffset For Each objField in objRS.Fields If IsNull(objField.Value) then objSpreadsheet.Cells(iRow, iCol).Value = "" Else objSpreadsheet.Cells(iRow, iCol).Value = objField.Value End If iCol = iCol + 1 Next 'objField objRS.MoveNext Loop End Sub Function SaveWorksheet(strFileName) 'Save the worksheet to a specified filename On Error Resume Next Call objSpreadsheet.ActiveSheet.Export(strFileName, 0) SaveWorksheet = (Err.Number = 0) End Function End Class %> <!-- #INCLUDE FILE="../librerias/conexion.asp"--> <% Dim objRS Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open "SELECT * FROM comuna", db 'objRS = db.execute("select * from comuna") Dim objExcel Set objExcel = New ExcelGen objExcel.RowOffset = 4 objExcel.ColumnOffset = 1 objExcel.GenerateWorksheet(objRS) If objExcel.SaveWorksheet(Server.MapPath("foo.xls")) then Response.Write "Worksheet saved. <a href=""foo.xls"">Download</a>" Else Response.Write "Error in saving worksheet!" End If Set objExcel = Nothing objRS.Close Set objRS = Nothing %> saludos y gracias |