|
하안인 님이 쓰신 글 :
: 답변 감사합니다.
:
: 액셀로 내보낼때 매크로 기록을 해서 해 보았는데 액셀에서 셀의 속성 정하는것을 그때도
: 못해서 텍스트만 내보낸적이 있어서...
:
: 워드에서 글씨를 쓸때
:
: WordDocument1->Range(EmptyParam, EmptyParam)->InsertAfter(StringToOleStr("Name:" + Table->Fields->Fields[3]->AsString + '\n'));
:
:
: 위와 같이 예제에 서 본대로만 사용해 봐서..
:
: 좌표의 위치를 옮기는 것이 아니라 파일의 끝에다 값만 대입해 봐서요.
: addline의 어느 매소드인지요.
:
: WordDocument1 컴포넌트의 Sentences는 아닌것 같구요.
:
: 처음 해보려니 아는것이 없어서
: 염치 불구하고 도움을 청합니다.
:
: 제가 아는 것이 워드에 연결해서 이미지나 위의 함수를 써서 문자를 내보내는 수준이거든요.
:
: 보고서를 만드는 정도의 스킬을 하려면 표와 위치안에 삽입같은것을 할수 있으면
: 좋겠는데요.
:
: WordDocument->Tables->Add(EmptyParam,2,5,wdWord9TableBehavior,wdAutoFitFixed);
:
: 이렇게 했는데 에러가 나네요.
: 인자가 5개와 6개 두개의 함수가 있고 매크로로 보면 비베에 정의된것이 5개라서
: 위와 같이 했는데 ..
:
: 원형이
: (RangePtr Range,long NumRows,Long NumColumns,Tvariant* DefaultTableBehavior,TVariant* AutoFitBehavior,
: TablePtr *prop);
:
: (RangePtr Range,long NumRows,Long NumColumns,Tvariant* DefaultTableBehavior,TVariant* AutoFitBehavior,
: );
:
: TablePtr이 무엇인지 몰라서 두번째 인자값 비슷하게 했는데..
: RangePtr, TablePtr은 헬프에 없어서..
표 삽입 및 선 그리기는 아래와 같습니다.
Variant wordApp, wordDocuments, wordDocument,wordNewLine, wordLine;
wordApp = Variant::CreateObject("Word.Application");
wordDocuments = wordApp.OlePropertyGet("Documents");
// wordDocument = wordDocuments.OleFunction("Open","??");
wordDocument = wordDocuments.OleFunction("Add",Variant::NoParam(),Variant::NoParam(),wdNewBlankDocument,Variant::NoParam());
wordNewLine = wordDocument.OlePropertyGet("Shapes").OleFunction("AddLine",100,100,400,100);
wordLine = wordNewLine.OlePropertyGet("Line");
wordLine.OlePropertySet("Weight",5);
wordLine.OlePropertySet("BeginArrowheadStyle",msoArrowheadNone);
wordLine.OlePropertySet("EndArrowheadStyle",msoArrowheadNone);
wordLine.OlePropertyGet("ForeColor").OlePropertySet("RGB",RGB(0,0,255));
//expression.Add(Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)
Variant wordRange = wordApp.OlePropertyGet("Selection").OlePropertyGet("Range");
wordDocument.OlePropertyGet("Tables").OleFunction("Add",wordRange,2,5,wdWord9TableBehavior,wdAutoFitFixed);
wordDocument.OleFunction("SaveAs","TestWordDoc.doc",wdFormatDocument,false);
wordDocument.OleFunction("Close");
wordDocument = Unassigned;
wordDocuments=Unassigned;
wordApp=Unassigned;
|