單位需要做報表,需要用pb匯出excel并加上密碼,匯出excel小弟會,但如何加上密碼請教各位大俠!
uj5u.com熱心網友回復:
Excel 開發人員參考Workbook.SaveAs 方法
全部顯示
全部隱藏
在另一不同檔案中保存對作業簿所做的更改。
語法
運算式.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)
uj5u.com熱心網友回復:
這個不是PB 的dw方法,是 Excel Workbook.SaveAs 的方法!!!!uj5u.com熱心網友回復:
測驗了一下,以下代碼可以,測驗環境pb12.5 + office2016string ls_file = "d:\111.xls"
dw_list.saveas(ls_file, excel8!, true)
//ActiveSheet.ProtectPassword:=641112'
integer li_value
oleobject ole_excel
ole_excel = create oleobject
li_value = ole_excel.connecttonewobject("excel.application")
if li_value <> 0 then
gnv_base.of_message("連接EXCEL失敗,請檢查")
return -1
end if
ole_excel.workbooks.open(ls_file)
string ls_file2 = "d:\222.xls"
ole_excel.ActiveWorkbook.SaveAs(ls_file2, 56, '1234')
ole_excel.quit()
ole_excel.disconnectobject()
destroy ole_excel
uj5u.com熱心網友回復:
好用



轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/22960.html
標籤:基礎類
