새 Visio 문서를 만들고 직사각형을 추가하는이 코드가 있습니다. 그것은 작동하지만 다른 문서를 열어 Masters 컬렉션을 가져 오는 것을 좋아하지 않습니다. 문제는 새 문서에 빈 Masters 셰이프 컬렉션이 있다는 것입니다. Document 클래스에서 Masters 컬렉션에 셰이프를 추가하는 메서드를 찾을 수 없으며 기존 문서가 있다고 가정하고 셰이프를 추가 할 수있는 모든 예제를 찾을 수 없습니다. 내가 원하는 것을 할 수있는 더 좋은 방법이 있습니까?새 Visio 문서에 도형 추가
// create the new application
Visio.Application va = new Microsoft.Office.Interop.Visio.Application();
// add a document
va.Documents.Add(@"");
// Visio.Documents vdocs = va.Documents;
// we need this document to get its Masters shapes collection
// since our new document has none
Visio.Document vu = vdocs.OpenEx(@"C:\Program Files (x86)\Microsoft Office\Office12\1033\Basic_U.vss", (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked);
// set the working document to our new document
Visio.Document vd = va.ActiveDocument;
// set the working page to the active page
Microsoft.Office.Interop.Visio.Page vp = va.ActivePage;
// if we try this from the Masters collection from our new document
// we get a run time since our masters collection is empty
Visio.Master vm = vu.Masters.get_ItemU(@"Rectangle");
Visio.Shape visioRectShape = vp.Drop(vm, 4.25, 5.5);
visioRectShape.Text = @"Rectangle text.";
감사합니다. 괜찮은 포럼 및/또는 프로그래밍 방식으로 Visio 문서를 생성하는 데 유용한 리소스에 대해 알고 있습니까? 나는 어제 이것에 약간 시간을 보냈고, 대부분 내 자신의 길을 더듬었다. 어떤 모양의 연결점이 무엇인지 파악하고 특정 연결 지점을 어떻게 처리 할 수 있습니까? –
이 두 링크를 확인하십시오 [프로세스 흐름 간 연결 분석 - VisGuy.com] (http://www.visguy.com/2009/04/22/analyze-connectivity-between-process-flows/) [Visio 만들기 프로그래밍 방식으로 플로 차트 (VisGuy.com) (http://www.visguy.com/2006/09/13/create-visio-flowcharts-programmatically/) – JohnGoldsmith
또한 특정 순서가 없음 : [Visio Automation - Saveen Reddy on CodePlex] (http://visioautomation.codeplex.com/) [Visio Guy forum] (http://visguy.com/vgforum/index.php) [TechNet] (http://social.technet.microsoft.com) com/Forums/ko-ko/visiogeneral/threads) [Visio 솔루션 개발 - 오래되었지만 훌륭한 리소스] (http://msdn.microsoft.com/en-us/library/aa245244%28office.10%29.aspx) [Visio 2010 SDK] (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=12365) 전체 목록을 보려면 [VisGuy.com의 링크 섹션] (http : //www.visguy.co.kr/visio-links /) – JohnGoldsmith