您的位置:首页 > 其它

VS2010 操作Word(六)测试结果

2013-02-26 09:25 218 查看
下面的是调用操组word的代码:

CJG_WordApi wordOpt;

wordOpt.CreateAPP();

wordOpt.CreateDocument();

wordOpt.SetPageSetup();

wordOpt.SetParaphformat(3);

wordOpt.SetFont(_T("黑体"),28,/*26367*/13107230);

wordOpt.WriteText(_T("测试"));

wordOpt.NewLine();

wordOpt.SetFont(_T("华文细黑"),12);

wordOpt.CreateTable(3,5);

wordOpt.WriteCellText(1,1,_T("测试"));

wordOpt.WriteCellText(1,2,_T("测试"));

wordOpt.WriteCellText(1,3,_T("测试"));

wordOpt.WriteCellText(1,4,_T("测试"));

wordOpt.WriteCellText(1,5,_T("测试"));

wordOpt.SetTableShading(1,1,13107230);

wordOpt.SetTableShading(1,2,13107230);

wordOpt.SetTableShading(1,3,13107230);

wordOpt.SetTableShading(1,4,13107230);

wordOpt.SetTableShading(1,5,13107230);

wordOpt.WriteCellText(2,1,_T(""));

wordOpt.SetFont(_T("华文细黑"),12);

wordOpt.CreateBookMark(_T("书签1"));

wordOpt.CreateHyperLink(_T("超链接1"),_T("书签2"));

wordOpt.WriteCellText(2,2,_T("测试"));

wordOpt.WriteCellText(2,3,_T("测试"));

wordOpt.WriteCellText(2,4,_T("测试"));

wordOpt.WriteCellText(2,5,_T("测试"));

wordOpt.WriteCellText(3,1,_T("测试"));

wordOpt.WriteCellText(3,2,_T("测试"));

wordOpt.WriteCellText(3,3,_T("测试"));

wordOpt.WriteCellText(3,4,_T("测试"));

wordOpt.WriteCellText(3,5,_T("测试"));

wordOpt.EndLine();

wordOpt.NewLine(3);

//wordOpt.PageBreak();

wordOpt.SetParaphformat(3);

wordOpt.SetFont(_T("隶书"),18);

wordOpt.WriteText(_T("测试"));

wordOpt.CreateBookMark(_T("书签2"));

wordOpt.WriteText(_T("("));

wordOpt.SetFont(_T("隶书"),18);

wordOpt.CreateHyperLink(_T("超链接2"),_T("书签1"));

wordOpt.WriteText(_T(")"));

wordOpt.NewLine();

wordOpt.SetFont(_T("黑体"),14);

wordOpt.WriteText(_T("——测试"));

wordOpt.NewLine();

wordOpt.SetParaphformat(2);

wordOpt.SetFont(_T("宋体"),10);

wordOpt.WriteText(_T("测试:2012/12/24-2012/12/31"));

wordOpt.NewLine();

wordOpt.SetParaphformat(1);

wordOpt.SetFont(_T("华文细黑"),12);

wordOpt.CreateTable(2,4);

wordOpt.SetTableFont(1,1,_T("华文细黑"),10);

wordOpt.WriteCellText(1,1,_T("测试"));

wordOpt.WriteCellText(1,2,_T("测试"));

wordOpt.WriteCellText(1,3,_T("测试"));

wordOpt.WriteCellText(1,4,_T("测试"));

wordOpt.WriteCellText(2,1,_T("测试"));

wordOpt.WriteCellText(2,2,_T("测试"));

wordOpt.WriteCellText(2,3,_T("测试"));

wordOpt.WriteCellText(2,4,_T("测试"));

wordOpt.SetTableShading(1,1,26367);

wordOpt.SetTableShading(2,1,26367);

wordOpt.SetTableShading(1,3,26367);

wordOpt.SetTableShading(2,3,26367);

wordOpt.EndLine();

CBitmap junk;

junk.LoadBitmapA(IDB_BITMAP1);

wordOpt.InsertShapes(&junk);

wordOpt.SaveAs(_T("D:\\doc1.doc"));

wordOpt.AppClose();

下面是结果图:



代码下载地址:http://download.csdn.net/detail/xiangjianbo127/5088353
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: