锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久久久综合日本,亚洲精品美女久久久久99小说 ,久久久久久久免费视频http://m.shnenglu.com/codeart/category/14770.htmlcodeArtzh-cnSun, 05 Sep 2010 00:19:10 GMTSun, 05 Sep 2010 00:19:10 GMT60c++鎿嶄綔word鎺ュ彛http://m.shnenglu.com/codeart/archive/2010/08/31/125430.htmlcodeArtcodeArtTue, 31 Aug 2010 11:35:00 GMThttp://m.shnenglu.com/codeart/archive/2010/08/31/125430.htmlhttp://m.shnenglu.com/codeart/comments/125430.htmlhttp://m.shnenglu.com/codeart/archive/2010/08/31/125430.html#Feedback0http://m.shnenglu.com/codeart/comments/commentRss/125430.htmlhttp://m.shnenglu.com/codeart/services/trackbacks/125430.html銆?銆戝紑鍚痺ord
_ApplicationPtr word_app;
HRESULT hr 
= word_app.CreateInstance("Word.Application", NULL); 
銆?銆戞柊寤轟竴涓枃妗?br>
COleVariant vTrue((short)TRUE),vFalse((short)FALSE),vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
DocumentsPtr docs;
_DocumentPtr oDoc;
docs 
= word_app->GetDocuments();
doc 
= docs->Add(vOpt, vOpt, vOpt, vOpt);  
銆?銆戣緗枃妗g殑欏甸潰甯冨眬
PageSetupPtr page_setup = doc->GetPageSetup();
page_setup
->PutTopMargin(0);
page_setup
->PutBottomMargin(0);
page_setup
->PutRightMargin(0);
page_setup
->PutLeftMargin(0);
銆?銆戞彃鍏ユ枃鏈?br>
SelectionPtr selection;
selection 
= word_app->GetSelection();
_ParagraphFormatPtr parafmt 
= selection->GetParagraphFormat();
parafmt
->PutLineSpacingRule(wdLineSpaceExactly);
parafmt
->PutLineSpacing(50);
_FontPtr font;
font 
= oSel->GetFont();
font
->PutBold(1);
font
->PutColor(wdColorGreen);
font
->PutSize(20);
font
->PutName(_T("瀹?huà)浣?/span>"));
selection
->TypeText("ABC");
oSel
->TypeParagraph();
oSel
->TypeText("12345678901234567890");
oSel
->TypeParagraph();
銆?銆戞彃鍏ユ枃鏈
ShapesPtr shapes = doc->GetShapes();
ShapePtr textbox 
=  shapspp->AddTextbox(Office::msoTextOrientationHorizontal, 11100100);
銆?銆戞枃鏈涓彃鍏ユ枃鏈?br>
 1ShapesPtr shapes = doc->GetShapes();
 2ShapePtr textbox =  shapspp->AddTextbox(Office::msoTextOrientationHorizontal, 11100100);
 3TextFramePtr textframe = textbox->GetTextFrame();
 4RangePtr range = textframe->GetTextRange();
 5long insert_before_count = range->Characters->GetCount();
 6range->InsertAfter("TEXT");
 7if (insert_before_count != 1)
 8    range->MoveStart(COleVariant((long)Word::wdCharacter), COleVariant(insert_before_count-1));
 9if(range != 0)
10{
11    _FontPtr font = range->GetFont();
12    font->PutBold(isBold);
13    font->PutItalic(isItalic);
14    font->PutColor((Word::WdColor)FontColor());
15    font->PutSize(FontSize);
16    font->PutName(FontType().c_str());
17}
銆?銆戣緗枃鏈鐨勫睘鎬?br>
1textbox->GetTextFrame()->PutAutoSize(Office::msoAutoShape);
2textbox->GetTextFrame()->PutMarginBottom(0);
3textbox->GetTextFrame()->PutMarginTop(0);
4textbox->GetTextFrame()->PutMarginLeft(0);
5textbox->GetTextFrame()->PutMarginRight(0);
6textbox->GetLine()->PutVisible(Office::msoFalse);
7textbox->GetFill()->PutTransparency(1);
銆?銆戞彃鍏ュ浘鐗囷紝榪欓噷闇瑕佹敞鎰忥紝蹇呴』寰楀厛鐢↖nlineShape,榪欐牱鍙互鎶婂浘鐗囨彃鍏ュ埌鎸囧畾鐨勯〉涓紝涓嶇劧錛屾墍鏈夌殑鍥劇墖鍙湪絎竴欏點(diǎn)?br>
 1ShapesPtr shapes = m_WordDoc->GetShapes();
 2InlineShapesPtr inline_shapes = selection_doc->GetRange()->GetInlineShapes();
 3InlineShapePtr inline_shape = inline_shapes->AddPicture(“picture_path”, COleVariant((long)0), COleVariant((long)1));
 4ShapePtr shape = inline_shape->ConvertToShape();
 5shape->PutWidth(width);
 6shape->PutHeight(hehight());
 7shape->PutTop(Y);
 8shape->PutLeft(X);
 9if(shape->GetType() == Office::msoPicture)
10{
11    Word::WrapFormatPtr wrapp = shape->GetWrapFormat();
12    wrapp->PutType(Word::wdWrapBehind);
13}

14
銆?銆戞彃鍏ョ洿綰?br>
1ShapesPtr shapes = doc->GetShapes();
2Word::ShapePtr line = shapes->AddLine(x1,y1, x2,y2);
3if (line->GetType() == Office::msoLine)
4{
5    Word::LineFormatPtr LineFmt = line->GetLine();
6    LineFmt->PutWeight(lr->weight_);
7}
銆?0銆戞彃鍏ュ垎闅旂
selection->InsertBreak(COleVariant((long)wdColumnBreak));
selection
->InsertBreak(COleVariant((long)wdSectionBreakContinuous));
selection
->InsertBreak(COleVariant((long)wdPageBreak));

銆?1銆戣緗爮鐩釜鏁板拰鏍忕洰鐨勫搴?br>榪欓噷涓瀹氳娉ㄦ剰add鍑芥暟鐨勯昏緫
1SectionsPtr word_sections = doc->GetSections();
2long num = word_sections->GetCount();
3SectionPtr word_section = word_sections->Item(num-1);
4PageSetupPtr page_setup = word_section->GetPageSetup();
5TextColumnsPtr text_cols = page_setup>GetTextColumns();
6text_cols->PutEvenlySpaced(0);
7text_cols->Add(COleVariant(col_width), COleVariant((long)0), COleVariant((long)false));
銆?2銆戞彃鍏ヨ〃鏍?br>
 1TablesPtr tables = oSel->GetTables();    
 2TablePtr table = tables->Add(oSel->GetRange(), 25);
 3    
 4BordersPtr bords = table->GetBorders();
 5bords->PutOutsideLineStyle(wdLineStyleSingle);
 6bords->PutInsideLineStyle(wdLineStyleSingle);
 7for (int i = 1; i<=2; i++)
 8{
 9    for (int j = 1; j<=5; j++)
10    {
11        table->Cell(i,j)->GetRange()->PutText("20");
12    }

13}

14
15CellPtr cell = table->Cell(1,1);
16cell->Merge(table->Cell(1,2));
銆?3銆戜繚瀛樻枃妗e茍閫鍑?br>
1COleVariant vTrue((short)TRUE),vFalse((short)FALSE),vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
2_DocumentPtr active_doc; 
3active_doc = word_app->GetActiveDocument();
4active_doc->SaveAs(COleVariant("D:\\doc1.doc"), 
5                   COleVariant((short)0),
6                   vFalse, COleVariant(""), vTrue, COleVariant(""),
7                   vFalse, vFalse, vFalse, vFalse, vFalse);
8word_app->Quit(vOpt, vOpt, vOpt);
鍦╳ord浼樼鐨勬瀯鏋朵腑榪樻湁璁歌澶氬鐨勬帴鍙o紝涓婇潰鍙槸涓句緥瀹炵幇涓涓櫘閫氱殑鏂囨。錛屽笇鏈涘澶у鏈夌敤銆?

codeArt 2010-08-31 19:35 鍙戣〃璇勮
]]>
BEGIN_COM_MAP鍜孍ND_COM_MAPhttp://m.shnenglu.com/codeart/archive/2010/07/05/119353.htmlcodeArtcodeArtMon, 05 Jul 2010 07:45:00 GMThttp://m.shnenglu.com/codeart/archive/2010/07/05/119353.htmlhttp://m.shnenglu.com/codeart/comments/119353.htmlhttp://m.shnenglu.com/codeart/archive/2010/07/05/119353.html#Feedback0http://m.shnenglu.com/codeart/comments/commentRss/119353.htmlhttp://m.shnenglu.com/codeart/services/trackbacks/119353.html  1 #define BEGIN_COM_MAP(x) public: \
  2     typedef x _ComMapClass; \
  3     static HRESULT WINAPI _Cache(void* pv, REFIID iid, void** ppvObject, DWORD_PTR dw) throw()\
  4 {\
  5     _ComMapClass* p = (_ComMapClass*)pv;\
  6     p->Lock();\
  7     HRESULT hRes = E_FAIL; \
  8     __try \
  9 { \
 10     hRes = ATL::CComObjectRootBase::_Cache(pv, iid, ppvObject, dw);\
 11 } \
 12     __finally \
 13 { \
 14     p->Unlock();\
 15 } \
 16     return hRes;\
 17 }\
 18     IUnknown* _GetRawUnknown() throw() \
 19 { ATLASSERT(_GetEntries()[0].pFunc == _ATL_SIMPLEMAPENTRY); return (IUnknown*)((INT_PTR)this+_GetEntries()->dw); } \
 20     _ATL_DECLARE_GET_UNKNOWN(x)\
 21     HRESULT _InternalQueryInterface(REFIID iid, void** ppvObject) throw() \
 22 return InternalQueryInterface(this, _GetEntries(), iid, ppvObject); } \
 23     const static ATL::_ATL_INTMAP_ENTRY* WINAPI _GetEntries() throw() { \
 24     static const ATL::_ATL_INTMAP_ENTRY _entries[] = { DEBUG_QI_ENTRY(x)
 25 
 26 #ifdef _ATL_DEBUG
 27 #define DEBUG_QI_ENTRY(x) \
 28 {NULL, \
 29     (DWORD_PTR)_T(#x), \
 30     (ATL::_ATL_CREATORARGFUNC*)0},
 31 #else
 32 #define DEBUG_QI_ENTRY(x)
 33 #endif //_ATL_DEBUG
 34 
 35 #define COM_INTERFACE_ENTRY_IMPL(x)\
 36     COM_INTERFACE_ENTRY_IID(_ATL_IIDOF(x), x##Impl<_ComMapClass>)
 37 
 38 #define _ATL_IIDOF(x) __uuidof(x)
 39 
 40 #define COM_INTERFACE_ENTRY_IID(iid, x)\
 41 {&iid,\
 42     offsetofclass(x, _ComMapClass),\
 43     _ATL_SIMPLEMAPENTRY},
 44 
 45 #define offsetofclass(base, derived) ((DWORD_PTR)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING)
 46 
 47 #define _ATL_SIMPLEMAPENTRY ((ATL::_ATL_CREATORARGFUNC*)1)
 48 
 49 #define COM_INTERFACE_ENTRY(x)\
 50 {&_ATL_IIDOF(x), \
 51     offsetofclass(x, _ComMapClass), \
 52     _ATL_SIMPLEMAPENTRY},
 53 
 54 #define END_COM_MAP() \
 55     __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }\
 56 {NULL, 00}}; return &_entries[1];} \
 57     virtual ULONG STDMETHODCALLTYPE AddRef( voidthrow() = 0; \
 58     virtual ULONG STDMETHODCALLTYPE Release( voidthrow() = 0; \
 59     STDMETHOD(QueryInterface)(REFIID, void**throw() = 0;
 60 #else
 61 #define END_COM_MAP() \
 62     __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }\
 63 {NULL, 00}}; return _entries;} \
 64     virtual ULONG STDMETHODCALLTYPE AddRef( voidthrow() = 0; \
 65     virtual ULONG STDMETHODCALLTYPE Release( voidthrow() = 0; \
 66     STDMETHOD(QueryInterface)(REFIID, void**throw() = 0;
 67 #endif // _ATL_DEBUG
 68 
 69 
 70 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 71 class d
 72 {
 73 public:
 74     d(){}
 75     typedef x _ComMapClass;
 76     static HRESULT WINAPI _Cache(void* pv, REFIID iid, void** ppvObject, DWORD_PTR dw) throw()\
 77     {
 78         _ComMapClass* p = (_ComMapClass*)pv;
 79         p->Lock();
 80         HRESULT hRes = E_FAIL;
 81         __try
 82         {
 83             hRes = ATL::CComObjectRootBase::_Cache(pv, iid, ppvObject, dw);
 84         }
 85         __finally
 86         {
 87             p->Unlock();
 88         }
 89         return hRes;
 90     }
 91     IUnknown* _GetRawUnknown() throw()
 92     { ATLASSERT(_GetEntries()[0].pFunc == _ATL_SIMPLEMAPENTRY); return (IUnknown*)((INT_PTR)this+_GetEntries()->dw); }
 93     _ATL_DECLARE_GET_UNKNOWN(x)
 94         HRESULT _InternalQueryInterface(REFIID iid, void** ppvObject) throw()
 95     { return InternalQueryInterface(this, _GetEntries(), iid, ppvObject); }
 96     const static ATL::_ATL_INTMAP_ENTRY* WINAPI _GetEntries() throw()
 97     {
 98         static const ATL::_ATL_INTMAP_ENTRY _entries[] =
 99         {
100             {NULL, (DWORD_PTR)_T(#x), (ATL::_ATL_CREATORARGFUNC*)0},
101             {&iid, ((DWORD_PTR)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING), ((ATL::_ATL_CREATORARGFUNC*)1)},
102             {&__uuidof(x), ((DWORD_PTR)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING), ((ATL::_ATL_CREATORARGFUNC*)1)},
103             __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }
104             {NULL, 00}
105         };
106         return &_entries[1];
107     }
108     virtual ULONG STDMETHODCALLTYPE AddRef( voidthrow() = 0;
109     virtual ULONG STDMETHODCALLTYPE Release( voidthrow() = 0;
110     STDMETHOD(QueryInterface)(REFIID, void**throw() = 0;
111 }


codeArt 2010-07-05 15:45 鍙戣〃璇勮
]]>
久久婷婷五月综合成人D啪| 国产69精品久久久久777| 久久九九兔免费精品6| 亚洲国产精品高清久久久| a级成人毛片久久| 伊人久久一区二区三区无码| 久久99精品久久久久久动态图| 国产精品免费久久久久久久久| 亚洲成色WWW久久网站| 久久有码中文字幕| 日本精品久久久中文字幕| 国产成人精品综合久久久久| 99久久精品九九亚洲精品| 久久WWW免费人成一看片| 国内精品久久久久久不卡影院| 精品国产一区二区三区久久久狼 | 亚洲人成无码网站久久99热国产| 久久久久99精品成人片欧美| 久久婷婷色香五月综合激情| 成人午夜精品久久久久久久小说| 久久久久AV综合网成人| 狠狠色噜噜色狠狠狠综合久久| 久久性生大片免费观看性| 伊人久久免费视频| 久久精品草草草| 中文字幕一区二区三区久久网站| 一本一道久久综合狠狠老 | 久久久人妻精品无码一区| 91精品无码久久久久久五月天| 国产亚洲精品久久久久秋霞 | 国产2021久久精品| 久久综合中文字幕| 久久精品国产一区| 久久香蕉综合色一综合色88| 久久99国产精品久久| 国产精品久久免费| 国产成人AV综合久久| 久久久久国产精品麻豆AR影院| 国产精品成人精品久久久| 日本久久久精品中文字幕| 久久久久香蕉视频|