Páginas

quinta-feira, 28 de janeiro de 2016

Wx - Exemplo Excel - Tom Silva






http://forum.pcsoft.fr/pt-BR/pcsoft.br.windev/883-exemplo-excel/read.awp

https://www.dropbox.com/s/5fd53o3qn3eez75/exemploExcel.rar?dl=0 







PROCEDURE WIN_MUESTRA_EXCEL()
//global declararion
gnFirstLineForOrderLine is int
gnLastLineForOrderLine is int






//Seleciona
// Opens the file picker
sFile is string = fSelect(fExeDir(), "", "Select a file...", "Excel or OpenOffice file" + TAB + "*.xls;*.xlsx", "*.xls;*.xlsx")


IF sFile <> "" THEN
   
    EDT_xslx_file = sFile   
   
    GetNbWorksheets(sFile)
   
END




PROCEDURE GetNbWorksheets(sFile)

MyXlsDoc is a xlsDocument = xlsOpen(sFile)
nNbWorksheets is int = xlsNbWorksheet(MyXlsDoc)

ListDeleteAll(COMBO_Worksheet)
FOR i = 1 _TO_  nNbWorksheets
    ListAdd(COMBO_Worksheet, i)   
END
ListSelectPlus(COMBO_Worksheet,1)





//Cargar Datos en la Planilla
sFile is string
IF EDT_xslx_file = "" THEN
   
    // Opens the file picker
    sFile = fSelect(fExeDir(), "", "Select a file...", "Excel or OpenOffice file" + TAB + "*.xls;*.xlsx", "*.xls;*.xlsx")
   
    IF sFile <> "" THEN
        EDT_xslx_file = sFile   
    END
   
END
IF EDT_xslx_file <> "" THEN
    SpreadsheetDeleteAll(PSHEET_PRODUCTOS)
    //The WLanguage SpreadsheetLoad function is used to load an Excel or OpenOffice Calc file in the Spreadsheet control of WinDev
    SpreadsheetLoad(PSHEET_PRODUCTOS, EDT_xslx_file, COMBO_Worksheet)
    SpreadsheetClose(PSHEET_PRODUCTOS)
END


CASE ERROR:
Error("The spreadsheet was not loaded.", ErrorInfo())

//left button
ExecuteProcess(MySelf, trtClick)
GR_1Step..Grayed = True
//GR_2Step..Grayed = False

EDT_TOTALINEAS = PSHEET_PRODUCTOS..NumberRow




//limpar
SpreadsheetDeleteAll(PSHEET_PRODUCTOS)





MySelf = fExeDir() + fSep() + "exemplo.xlsx"






Nenhum comentário:

Postar um comentário