Hi i am creating visio shapes programatically using c#.
In visio am creating composite diagrams ( sub - process ) using the below code.
Visio.Shape ParentShape = myShape;
ParentShape.CreateSubProcess(); //it will create a sub diagram for the shape
using this am creating subprocess(composite) diagram for the shape.
But now i need to link a sub process diagram to one or more parent shapes.
In Visio it can be simply done by clicking Link to SubProcess option.
But i want to acheive it in visio API..Is it possible to acheive it ..??
Question is:
How to assign a page to multiple shapes as sub-process in API .?
For linking a single page to multiple shape sub-process is done by adding the page name as hyperlink for that shapes , to which we need sub-process to be created.
Visio.Hyperlink vsoHyperlink = ParentShape.AddHyperlink();
vsoHyperlink.SubAddress = PageName;
ParentShape - the shape for which the sup-process (or ) composite to be created.
PageName- the name of the page or diagram in visio, which needs to be treated as sup-process (or ) composite
Related
I´m creating a word document with openXML. This file includes several pages and chapters. Chapters of level 1 are automatically placed on a new page using
...new Break() { Type = BreakValues.Page });
. Now I would like to write a logic that moves sub-chapters to the next page, if they are at the end of a page and no content is following them (on this page).
Short: I´m looking for a way to minimize postediting on my newly created word document.
I want to copy master layout from one presentation to another.
If I wanted to copy a slide the code would be Presentation.Slides[1].Copy, however I can't find similar code for copying master layout. There is Presentation.SlideMaster.Delete() but for some reason there is no copy. If it is not possible in c# is it possible in vba??
I want to basically automate this
This is the VBA code to copy a design from one presentation to the other - http://skp.mvps.org/pptxp018.htm. The same is achievable in C#.
Sub CopyDesigns()
Dim oSourceDesigns As Presentation
Dim I As Integer
Set oSourceDesigns = Presentations.Open("K:\Docs\main.pot", , , False)
For I = 1 To oSourceDesigns.Designs.Count
ActivePresentation.Designs.Clone oSourceDesigns.Designs(I)
Next I
oSourceDesigns.Close
Set oSourceDesigns = Nothing
End Sub
I have downloaded a component (Edraw Viewer Component) for word documents viewing, customization, etc...
I could not post the image since I need 10 reputation.
Please find the question on MSDN forum on the following link.
(In case the text written on image is not visible, Please find it below)
TEXT:
After selecting a word document, it seems that the EDRAW viewer control is changing the parent window of the word application and set it to an MDI contained form that opens within the main menu (check image; you could see that the MS-Word app is embedded within the windows form.)
What is really confusing, is how could they access the Copy, cut and paste buttons and disable them.
Also note that the latter buttons were disabled at the level of the document and not the entire application. (This means whenever I open another instance of MS-Word outside the menu, Copy-Cut and paste are enabled).
The software is not using CustomUI to customize the ribbon, nor VBA scripts, plus, the Word Object Model does not expose any property or method related to these buttons.
Please note that I have also tried using windows automation, accessed the word application and all of its controls (Tab, Buttons...), but the Control IDs were never accessible.
Please Find a code snippet:
Private _clientAppRootInstance As AutomationElement = Nothing
Me._clientAppRootInstance = AutomationElement.RootElement.FindFirst(TreeScope.Children, New PropertyCondition(AutomationElement.NameProperty, "Document1 - Microsoft Word"))
For Each inst as AutomationElement In Me._clientAppRootInstance.FindAll(TreeScope.Descendants, _
New OrCondition( _
New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button), _
New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Custom) _
))
If CType(inst.Current, AutomationElement.AutomationElementInformation).Name = "Copy" Then
If inst.Current.AutomationId <> "" Then
PstBtnID = inst.Current.AutomationId
End If
End If
Next
End If
At this level, please note that all inst.Current.AutomationID (which represent the ControlID, that I shall allow me accessing control handle and using windows API functions to manipulate its behavior) is always empty.
I tried this same example on windows calculator (calc.exe) and it worked like dream ( I could access each button through its controlID)
Your Help is much appreciated.
Regards.
I recently started working on a project that has been in development for some time now. The problem is this - in the web site page, a have a frame (amongst 4 others) in a frameset which contains the SVG map object (the whole site is GIS based). Also, in the same frame, there is a icon for opening the form in which user can choose a number of filters, and after he presses a button, the map refreshes and the area of influence around some key points on the map are drawn.
What i need to do is to open that form in a new (popup) window and not in the same frame where the map is. I did that this way:
onclick="window.open('zi.aspx','form1','width=700,height=500,left=350,top=100')"
This works fine. But then, when i enter the filters and hit Generate button, i get this error:
'parent.frames.map' is null or not an object
with the reference to zi.aspx. Now i know that this error is because i changed the form from opening in the same frame as map to opening it in a popup window, but i just can't find anywhere in the code where can i modify it. Before my changes, the code was just this:
onclick="showZi();"
and that is the function i can't find anywhere. Any ideas? How can i make this work, to make a map with filters drawn after the user has chosen appropriate ones from the popup window form? I should mention that this image link is in the ASP.NET table, with standard runat="server" command.
Okay, so you're opening a new window from javascript. Your problem is that you're trying to access the parent window by using the 'window.parent' property. This is wrong, you'll need to instead use 'window.opener' property. E.g.:
window.opener.frames.map
I need to change a slide's layout programmaticaly with C# (Add-In Express 2009 for Office and .NET is used). If the new layout is a predefined one then everything is fine, but not if I need to set a custom layout as a new one (without slide recreating). Unfortunately, I didn't find any information on how to do it, PowerPoint object model reference documentation didn't answer me as well. There is just the ability to create a new slide that uses custom layout.
I've done an experiment and have ensured that the Slide object stayed being the same while I have been changing layout both predefined and custom ones. I don't want to create a new slide when I need just switch the layout.
Is it possible at all? Please help me to find a way of doing it.
The only way it will work is if your custom layout is actually used in the deck first. Then you simply take that layout and apply it to the slide you want. You could programatically create a new slide with your custom layout, use it's layout to apply to another slide and then delete that new slide you had created. Here's code to apply the custom layout (note that my ap.Slides(2) is a Custom Layout)
Sub ChangeLayout()
Dim ap As Presentation
Set ap = ActivePresentation
Dim slide1 As Slide
Set slide1 = ap.Slides(1)
Dim customLayout As PpSlideLayout
customLayout = ap.Slides(2).Layout
slide1.Layout = ly
End Sub
You could do that, but it's really not recommended. Also, creating a new slide this way and applying the layout is prone to errors. In the following code snippet you can see how to retrieve a layout by name from the master....
private PowerPoint.CustomLayout DpGetCustomLayout(
PowerPoint.Presentation ppPresentation, string myLayout)
{
//
// Given a custom layout name, find the layout in the master slide and return it
// Return null if not found
//
PowerPoint.CustomLayout ppCustomLayout = null;
for (int i = 0; i < ppPresentation.SlideMaster.CustomLayouts.Count; i++)
{
if (ppPresentation.SlideMaster.CustomLayouts[i + 1].Name == myLayout)
ppCustomLayout = ppPresentation.SlideMaster.CustomLayouts[i + 1];
}
return ppCustomLayout;
}
then you can assign it to the slide as you saw above. However, if the layouts are incompatible, then results may be unpredictable. I assume that the slides are at least relatively the same. You should try to create a new slide and copy the content over to avoid being hostage to changes in the underlying theme or template.
See code descriptions for more on this.