Re: [分享] Excel function with MFC

看板C_and_CPP作者 (藍影)時間14年前 (2011/07/08 15:29), 編輯推噓3(306)
留言9則, 5人參與, 最新討論串2/2 (看更多)
※ 引述《Zephyr750 (紅蓮西風750)》之銘言: 恕刪 我只是補一點意見而已 @@ 之前我設計的 class 還有幾個功能,都不難, 可以做為你這份 class 日後擴充的參考 1. Sheet 操作部份 a. long GetSheetNum(); b. BOOL InsertSheet(long nIndex, CString SheetName); // 插入 sheet c. BOOL DelSheetIndex(long nIndex); // start from 1 // 刪除 d. BOOL SetActiveSheet(long nIndex); // 設定當前 Sheet 2. 儲存格部份 void ClearRange(CString StartCell, CString EndCell); -- 清除一個 range 不要逐一 cell 去清, 速度會慢很多 3. 儲存格讀取部份 CString ReadAsString(CString Cell); // as string read CString ReadAsInteger(CString Cell, int &value); CString ReadAsDouble(CString Cell, double &value); // as double read CString ReadAsDate(CString Cell, SYSTEMTIME& Date); CString ReadAsTime(CString Cell, SYSTEMTIME& Time); CString ReadAsDateTime(CString Cell, SYSTEMTIME& DateTime); 4. 排序功能 void Sort1(CString StartCell, CString EndCell, CString IndexCell, long DeCrement); -- excel 排序,可以有很多鍵值,我只寫到三種鍵值排序 5. 圖表功能 // 畫圖表, ChartType 記得有近 50 個數值,可以畫不同圖表 void DrawChart(UINT StartX, UINT StartY, UINT EndX, UINT EndY, long ChartType, short PlotBy, short StartFrom, CString TitleString, CString X_String, CString Y_String, UINT ChartStartX, UINT ChartStartY, UINT width, UINT height); void SaveChart(CString FullBmpPathName); // 將畫出來的圖表存成一張圖片 ------- 我包出來的 source 非常大, 357k, 不放上,功能不少, 但確實你包得比較漂亮. 提醒注意的是, 之前在做 excel 自動化時,MFC 用多行緒會出包 (跳出一個視窗說 COM 不能用) 這情形在 6.0 似乎常見, 有人說是無解問題, 不知之後版本有無改善。 (其實 excel 還是建議寫 vba 就好 XD) -- YouLoveMe() ? LetItBe() : LetMeFree(); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 180.177.73.222

07/08 21:15, , 1F
謝謝...推你最後一句
07/08 21:15, 1F

07/08 21:20, , 2F
而且...這篇的功能,我剛好都找不到耶....
07/08 21:20, 2F

07/08 22:41, , 3F
已寄信,這套 cexcl 我真的寫很久..
07/08 22:41, 3F

07/08 23:15, , 4F
再次分享前,我會先寄給你一份,彼此認可之後再發布!^^
07/08 23:15, 4F

07/09 00:52, , 5F
Ruby::win32ole XXD
07/09 00:52, 5F

07/09 02:01, , 6F
請問有PowerPoint的嗎?
07/09 02:01, 6F

07/09 03:23, , 8F
感謝 :D
07/09 03:23, 8F

07/09 21:47, , 9F
雖然我不認識妳,但是我要謝謝你.這篇可以加入精華區嗎?
07/09 21:47, 9F
文章代碼(AID): #1E5h7ebB (C_and_CPP)
文章代碼(AID): #1E5h7ebB (C_and_CPP)