![VC生成word文檔的部分代碼的記錄_第1頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/4/3af4432f-a151-482a-af98-b40c281baa2c/3af4432f-a151-482a-af98-b40c281baa2c1.gif)
![VC生成word文檔的部分代碼的記錄_第2頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/4/3af4432f-a151-482a-af98-b40c281baa2c/3af4432f-a151-482a-af98-b40c281baa2c2.gif)
![VC生成word文檔的部分代碼的記錄_第3頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/4/3af4432f-a151-482a-af98-b40c281baa2c/3af4432f-a151-482a-af98-b40c281baa2c3.gif)
![VC生成word文檔的部分代碼的記錄_第4頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/4/3af4432f-a151-482a-af98-b40c281baa2c/3af4432f-a151-482a-af98-b40c281baa2c4.gif)
下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、protected:/變量 _application wordapp; documents worddocs; _document worddoc; selection wordselection; range wordrange; tables wordtables; table wordtable; cell wordcell; cells wordcells; _font wordfont; void cautoyaoce:oncreatereport() / currentcount mothervoltagecount commonvoltagecount powercount po
2、werfactorcount frequencycount / todo:初始化word :coinitialize(null); /初始化com組件(必須添加,否則無(wú)法啟動(dòng)word)調(diào)用完畢后 couninitialize(); if (!wordapp.createdispatch(_t(word.application) afxmessagebox(word createdispatch failed!); wordapp.setvisible(true);/make visible wordapp.activate();/激活 worddocs=wordapp.getdocuments
3、();/get documents object / ccomvariant tpl(_t(),visble,doctype(0),newtemplate(false); worddoc=worddocs.add(&tpl,&newtemplate,&doctype,&visble); wordselection=wordapp.getselection(); systemtime systime; getlocaltime(&systime); cstring strreport; strreport.format( 日期: %d-%d-%d 時(shí)間: %d:%d:%d rn rn,systi
4、me.wyear,systime.wmonth,systime.wday,systime.whour,systime.wminute,systime.wsecond); wordselection.typetext(strreport); updatedata(); cstring m_pct; m_pct.format(ct變比:%f,m_ct); wordselection.typetext(m_pct+ ); m_pct.format(pt變比:%f,m_pt); wordselection.typetext(m_pct+rn); /todo:在word中插入表格 if(currentc
5、ount) createdoc(遙測(cè)電流幅值檢驗(yàn),currentbuf,currentcount,3); /生成電流報(bào)表 if(mothervoltagecount) createdoc(遙測(cè)電壓母線幅值檢驗(yàn),mothervoltagebuf,currentcount,3); /生成母線電壓報(bào)表 if(commonvoltagecount) createdoc(遙測(cè)電壓普線幅值檢驗(yàn),commonvoltagebuf,currentcount,3); /生成普線電壓報(bào)表 if(powercount) createdoc(遙測(cè)功率測(cè)量檢驗(yàn),powerbuf,currentcount,2); /生成
6、功率報(bào)表 if(powerfactorcount) createdoc(遙測(cè)功率因數(shù)測(cè)量檢驗(yàn),powerfactorbuf,currentcount,1); /生成功率因數(shù)報(bào)表 if(frequencycount) createdoc(遙測(cè)頻率測(cè)量檢驗(yàn),frequencybuf,currentcount,1); /生成頻率報(bào)表 /todo:保存word ccomvariant filename,fileformat(0),lockcomments(false),password(_t(),addtorecentfiles(true),writepassword(_t(); ccomvarian
7、t readonlyrecommended(false),embedtruetypefonts(false),savenativepictureformat(false),saveformsdata(false),saveasaoceletter(false); ccomvariant encoding(false),insertlinebreaks(false),allowsubstitutions(false),lineending(false),addbidimarks(false); strreport.format(d:%d年%d月%d日%d時(shí)%d分%d秒 報(bào)告,systime.wy
8、ear,systime.wmonth,systime.wday,systime.whour,systime.wminute,systime.wsecond); filename=strreport; /文件名 worddoc.saveas(&filename,&fileformat,&lockcomments,&password,&addtorecentfiles,&writepassword, &readonlyrecommended,&embedtruetypefonts,&savenativepictureformat,&saveformsdata, &saveasaoceletter,
9、 &encoding,&insertlinebreaks,&allowsubstitutions,&lineending,&addbidimarks); wordfont.releasedispatch();wordcells.releasedispatch();wordtable.releasedispatch();wordtables.releasedispatch();wordrange.releasedispatch(); wordselection.releasedispatch();worddoc.releasedispatch();worddocs.releasedispatch
10、();wordapp.releasedispatch(); :coinitialize(null); void cautoyaoce:createcurrentdoc() wordselection.typetext( 遙測(cè)電流幅值檢驗(yàn)報(bào)表rn rn); wordselection.typetext( 日期: 2008-*-*時(shí)間: *:*rn rn); wordtables=worddoc.gettables(); wordrange=wordselection.getrange(); ccomvariant defaultbehavior(1),autofitbehavior(0); wo
11、rdtable=wordtables.add(wordrange,7,7,&defaultbehavior,&autofitbehavior); / updatedata(); wordcell=wordtable.cell(1,1); wordcell.select(); wordselection.movedown(&ccomvariant(5),&ccomvariant(1),&ccomvariant(1); wordcells=wordselection.getcells(); wordcells.merge(); wordcells.setverticalalignment(1);
12、wordselection.typetext(二次電流); wordcell=wordtable.cell(1,2); wordcell.select(); wordselection.moveright(&ccomvariant(1),&ccomvariant(2),&ccomvariant(1); /合并單元格時(shí)要使用&ccomvariant(1) wordcells=wordselection.getcells(); wordcells.merge(); wordselection.typetext(測(cè)控裝置顯示值); wordcell=wordtable.cell(1,3); word
13、cell.select(); wordselection.moveright(&ccomvariant(1),&ccomvariant(2),&ccomvariant(1); wordcells=wordselection.getcells(); wordcells.merge(); wordselection.typetext(操作員工作站顯示值); wordselection.moveright(&ccomvariant(12),&ccomvariant(2),&ccomvariant(0); cstring temp6=ia(a),ib(a),ic(a),ia(a),ib(a),ic(a
14、); for(int i=0;i6;i+) wordselection.typetext(tempi); wordselection.moveright(&ccomvariant(12),&ccomvariant(1),&ccomvariant(0); /單純右移時(shí)使用&ccomvariant(12) cstring str21=1.0000,x,x,x,x,x,x,5.0000,xx,xx,xx,xx,xx,xx,基本誤差,xxx,xxx,xxx,xxx,xxx,xxx; for(i=0;i21;i+) wordselection.typetext(stri); wordselection.
15、moveright(&ccomvariant(12),&ccomvariant(1),&ccomvariant(0); wordselection.typetext(結(jié)論); wordcell=wordtable.cell(6,2); wordcell.select(); wordselection.moveright(&ccomvariant(1),&ccomvariant(5),&ccomvariant(1); wordcells=wordselection.getcells(); wordcells.merge(); wordselection.typetext(合格); wordselection.moveright(&ccomvariant(12),&ccomvariant(1),&ccomvariant(0); wordselection.typetext(備注); wordcell=wordtable.cell(7,2); wordcell.select(); wordselection.moveright(&ccomvar
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 新版北師版一年級(jí)下冊(cè)數(shù)學(xué)課件五 100以內(nèi)數(shù)加與減(一)復(fù)習(xí)
- 線上教育投資咨詢合同(2篇)
- 2024-2025學(xué)年云南昭通部分縣區(qū)高二上學(xué)期期末聯(lián)合檢測(cè)英語(yǔ)試卷(解析版)
- Module2Unit2ImwatchingTV2023-2024學(xué)年三年級(jí)英語(yǔ)
- 2025年含油生料帶盤根項(xiàng)目投資可行性研究分析報(bào)告
- 2024-2025年中國(guó)音樂(lè)平臺(tái)行業(yè)市場(chǎng)調(diào)查研究及投資前景預(yù)測(cè)報(bào)告
- 2020-2025年中國(guó)鍋爐輔機(jī)行業(yè)市場(chǎng)調(diào)研分析及投資戰(zhàn)略咨詢報(bào)告
- 電競(jìng)文化與環(huán)保意識(shí)的融合之路
- 電子設(shè)備垃圾處置過(guò)程中的信息安全防護(hù)
- 疫情下醫(yī)院物資管理的醫(yī)防融合策略研究
- 東華醫(yī)院麻醉科QoR-40隨訪表
- 2022年全國(guó)新高考Ⅰ卷:馮至《江上》
- DB51∕T 2767-2021 安全生產(chǎn)風(fēng)險(xiǎn)分級(jí)管控體系通則
- 反興奮劑考試試題與解析
- 建筑工程材料取樣及收費(fèi)標(biāo)準(zhǔn)
- 堤壩工程施工組織設(shè)計(jì)
- CPIM BSCM__v3_0_VC(課堂PPT)
- 常用的螺紋底孔及公差規(guī)定
- 會(huì)議審批表模板
- 空調(diào)線路安裝施工方案與技術(shù)措施
- 建筑工程施工質(zhì)量驗(yàn)收規(guī)范檢驗(yàn)批填寫全套表格+示范填寫與說(shuō)明
評(píng)論
0/150
提交評(píng)論