├── .gitattributes
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CS
├── AnthonyDuguid.pfx
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── Settings.png
│ └── VisioAddin.png
├── Ribbon.cs
├── Ribbon.xml
├── Scripts
│ ├── AssemblyInfo.cs
│ ├── ErrorHandler.cs
│ └── Ribbon_Buttons.cs
├── ShapeExtract.csproj
├── ShapeExtract.sln
├── ThisAddIn.Designer.cs
├── ThisAddIn.Designer.xml
├── ThisAddIn.cs
├── app.config
└── packages.config
├── Images
└── ReadMe
│ ├── header.png
│ ├── header.pptx
│ ├── header_footer.vsdx
│ ├── ribbon.group.about.png
│ ├── ribbon.group.help.png
│ ├── vsto.ribbon.settings.png
│ └── vsto.visio.shape.extract.png
├── LICENSE
├── README.md
├── VB
├── AnthonyDuguid.pfx
├── Forms
│ ├── Settings.designer.vb
│ ├── Settings.resx
│ └── Settings.vb
├── My Project
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── Resources
│ ├── GroupInfo.png
│ ├── HelpApi.png
│ ├── HelpAsBuilt.png
│ ├── HelpEmail.png
│ ├── Settings.png
│ └── VisioAddin.png
├── Ribbon.xml
├── Scripts
│ ├── AssemblyInfo.vb
│ ├── ErrorHandler.vb
│ ├── Ribbon_Buttons.vb
│ └── Ribbon_Events.vb
├── ShapeExtract.sln
├── ShapeExtract.vbproj
├── ThisAddIn.Designer.vb
├── ThisAddIn.Designer.xml
├── ThisAddIn.vb
└── app.config
└── VBA
├── ShapeExtract.Original.VBA.txt
├── ShapeExtract.vsdm
└── header_footer.vsdx
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /VB/obj/Debug
2 | /VB/bin/Debug
3 | /VB/.vs/ShapeExtract/v14
4 | /VB/obj/Debug
5 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at anthonyduguid@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CS/AnthonyDuguid.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/CS/AnthonyDuguid.pfx
--------------------------------------------------------------------------------
/CS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Security;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("Shape Extract")]
10 | [assembly: AssemblyDescription("Visio Addin Shape Extract")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("Anthony Duguid")]
13 | [assembly: AssemblyProduct("ShapeExtract")]
14 | [assembly: AssemblyCopyright("Anthony Duguid")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("870111f5-d6ab-4fad-b05a-2aa78b377764")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("1.0.0.0")]
37 | [assembly: AssemblyFileVersion("1.0.0.0")]
38 |
39 |
--------------------------------------------------------------------------------
/CS/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ShapeExtract.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShapeExtract.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap Settings {
67 | get {
68 | object obj = ResourceManager.GetObject("Settings", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 |
73 | ///
74 | /// Looks up a localized resource of type System.Drawing.Bitmap.
75 | ///
76 | internal static System.Drawing.Bitmap VisioAddin {
77 | get {
78 | object obj = ResourceManager.GetObject("VisioAddin", resourceCulture);
79 | return ((System.Drawing.Bitmap)(obj));
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/CS/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\Settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
125 | ..\Resources\VisioAddin.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
126 |
127 |
--------------------------------------------------------------------------------
/CS/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ShapeExtract.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("Anthony Duguid")]
29 | public string App_Author {
30 | get {
31 | return ((string)(this["App_Author"]));
32 | }
33 | }
34 |
35 | [global::System.Configuration.UserScopedSettingAttribute()]
36 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
37 | [global::System.Configuration.DefaultSettingValueAttribute("")]
38 | public string App_FileExport {
39 | get {
40 | return ((string)(this["App_FileExport"]));
41 | }
42 | set {
43 | this["App_FileExport"] = value;
44 | }
45 | }
46 |
47 | [global::System.Configuration.UserScopedSettingAttribute()]
48 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
49 | [global::System.Configuration.DefaultSettingValueAttribute("C:\\Temp")]
50 | public string App_PathExportLocation {
51 | get {
52 | return ((string)(this["App_PathExportLocation"]));
53 | }
54 | set {
55 | this["App_PathExportLocation"] = value;
56 | }
57 | }
58 |
59 | [global::System.Configuration.UserScopedSettingAttribute()]
60 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
61 | [global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Office-projects/VisioShapeExtract/blob/master/README.md")]
62 | public string App_PathReadMe {
63 | get {
64 | return ((string)(this["App_PathReadMe"]));
65 | }
66 | set {
67 | this["App_PathReadMe"] = value;
68 | }
69 | }
70 |
71 | [global::System.Configuration.UserScopedSettingAttribute()]
72 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
73 | [global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Office-projects/VisioShapeExtract/issues/new")]
74 | public string App_PathReportIssue {
75 | get {
76 | return ((string)(this["App_PathReportIssue"]));
77 | }
78 | set {
79 | this["App_PathReportIssue"] = value;
80 | }
81 | }
82 |
83 | [global::System.Configuration.UserScopedSettingAttribute()]
84 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
85 | [global::System.Configuration.DefaultSettingValueAttribute("07/31/2017 13:05:00")]
86 | public global::System.DateTime App_ReleaseDate {
87 | get {
88 | return ((global::System.DateTime)(this["App_ReleaseDate"]));
89 | }
90 | set {
91 | this["App_ReleaseDate"] = value;
92 | }
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/CS/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Anthony Duguid
7 |
8 |
9 |
10 |
11 |
12 | C:\Temp
13 |
14 |
15 | https://github.com/Office-projects/VisioShapeExtract/blob/master/README.md
16 |
17 |
18 | https://github.com/Office-projects/VisioShapeExtract/issues/new
19 |
20 |
21 | 07/31/2017 13:05:00
22 |
23 |
24 |
--------------------------------------------------------------------------------
/CS/Resources/Settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/CS/Resources/Settings.png
--------------------------------------------------------------------------------
/CS/Resources/VisioAddin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/CS/Resources/VisioAddin.png
--------------------------------------------------------------------------------
/CS/Ribbon.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Windows.Forms;
5 | using System.Linq;
6 | using System.Reflection;
7 | using System.Runtime.InteropServices;
8 | using System.Text;
9 | using Office = Microsoft.Office.Core;
10 | using ShapeExtract.Scripts;
11 |
12 | namespace ShapeExtract
13 | {
14 | [ComVisible(true)]
15 | public class Ribbon : Office.IRibbonExtensibility
16 | {
17 | private Office.IRibbonUI ribbon;
18 |
19 | public Ribbon()
20 | {
21 | }
22 |
23 | public string GetCustomUI(string ribbonID)
24 | {
25 | return GetResourceText("ShapeExtract.Ribbon.xml");
26 | }
27 |
28 | public void Ribbon_Load(Office.IRibbonUI ribbonUI)
29 | {
30 | this.ribbon = ribbonUI;
31 | //AssemblyInfo.SetAddRemoveProgramsIcon("ExcelAddin.ico");
32 | }
33 |
34 | private static string GetResourceText(string resourceName)
35 | {
36 | Assembly asm = Assembly.GetExecutingAssembly();
37 | string[] resourceNames = asm.GetManifestResourceNames();
38 | for (int i = 0; i < resourceNames.Length; ++i)
39 | {
40 | if (string.Compare(resourceName, resourceNames[i], StringComparison.OrdinalIgnoreCase) == 0)
41 | {
42 | using (StreamReader resourceReader = new StreamReader(asm.GetManifestResourceStream(resourceNames[i])))
43 | {
44 | if (resourceReader != null)
45 | {
46 | return resourceReader.ReadToEnd();
47 | }
48 | }
49 | }
50 | }
51 | return null;
52 | }
53 |
54 | ///
55 | /// Assigns the value to an application setting
56 | ///
57 | /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
58 | /// A method that returns true or false if the control is enabled
59 | public void OnAction(Office.IRibbonControl control)
60 | {
61 | try
62 | {
63 | switch (control.Id)
64 | {
65 | case "btnExtractShapes":
66 | ExportShapeValues();
67 | break;
68 | case "btnOpenFolder":
69 | OpenFile();
70 | break;
71 | case "btnSettings":
72 | OpenSettings();
73 | break;
74 | case "btnOpenReadMe":
75 | OpenReadMe();
76 | break;
77 | case "btnOpenNewIssue":
78 | OpenNewIssue();
79 | break;
80 | }
81 | }
82 | catch (Exception ex)
83 | {
84 | ErrorHandler.DisplayMessage(ex);
85 | }
86 |
87 | }
88 |
89 | ///
90 | /// Assigns text to a label on the ribbon from the xml file
91 | ///
92 | /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
93 | /// A method that returns a string for a label.
94 | public string GetLabelText(Office.IRibbonControl control)
95 | {
96 | try
97 | {
98 | switch (control.Id)
99 | {
100 | case "tabShapeExtract":
101 | if (Application.ProductVersion.Substring(0, 2) == "15") //for Excel 2013
102 | {
103 | return AssemblyInfo.Title.ToUpper();
104 | }
105 | else
106 | {
107 | return AssemblyInfo.Title;
108 | }
109 | case "txtCopyright":
110 | return "© " + AssemblyInfo.Copyright;
111 | case "txtDescription":
112 | return AssemblyInfo.Title.Replace("&", "&&") + " " + AssemblyInfo.AssemblyVersion;
113 | case "txtReleaseDate":
114 | System.DateTime dteCreateDate = Properties.Settings.Default.App_ReleaseDate;
115 | //return dteCreateDate.ToString("dd-MMM-yyyy hh:mm tt");
116 | return string.Empty;
117 | default:
118 | return string.Empty;
119 | }
120 | }
121 | catch (Exception ex)
122 | {
123 | ErrorHandler.DisplayMessage(ex);
124 | return string.Empty;
125 | }
126 | }
127 |
128 |
129 |
130 | public static void ExportShapeValues()
131 | {
132 |
133 | }
134 |
135 | public static void OpenFile()
136 | {
137 | string filePath = Properties.Settings.Default.App_FileExport;
138 | try
139 | {
140 | if (filePath == string.Empty)
141 | return;
142 | var attributes = File.GetAttributes(filePath);
143 | File.SetAttributes(filePath, attributes | FileAttributes.ReadOnly);
144 | System.Diagnostics.Process.Start(filePath);
145 |
146 | }
147 | catch (System.ComponentModel.Win32Exception)
148 | {
149 | MessageBox.Show("No application is assicated to this file type." + Environment.NewLine + Environment.NewLine + filePath, "No action taken.", MessageBoxButtons.OK, MessageBoxIcon.Information);
150 | return;
151 |
152 | }
153 | catch (Exception ex)
154 | {
155 | ErrorHandler.DisplayMessage(ex);
156 |
157 | }
158 | }
159 |
160 | ///
161 | /// Opens the settings taskpane
162 | ///
163 | ///
164 | public static void OpenSettings()
165 | {
166 | try
167 | {
168 | //open settings form
169 |
170 | }
171 | catch (Exception ex)
172 | {
173 | ErrorHandler.DisplayMessage(ex);
174 | }
175 | }
176 |
177 | ///
178 | /// Opens an as built help file
179 | ///
180 | ///
181 | public static void OpenReadMe()
182 | {
183 | //ErrorHandler.CreateLogRecord();
184 | System.Diagnostics.Process.Start(Properties.Settings.Default.App_PathReadMe);
185 |
186 | }
187 |
188 | ///
189 | /// Opens an as built help file
190 | ///
191 | ///
192 | public static void OpenNewIssue()
193 | {
194 | //ErrorHandler.CreateLogRecord();
195 | System.Diagnostics.Process.Start(Properties.Settings.Default.App_PathReportIssue);
196 |
197 | }
198 |
199 | }
200 | }
201 |
--------------------------------------------------------------------------------
/CS/Ribbon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/CS/Scripts/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Reflection;
4 | using System.Diagnostics;
5 | using System.Windows.Forms;
6 | using System.Deployment.Application;
7 | using Microsoft.Win32;
8 |
9 | //
10 | // This namespaces if for generic application classes
11 | //
12 | namespace ShapeExtract.Scripts
13 | {
14 | ///
15 | /// Used to get the assembly information
16 | ///
17 | ///
18 | /// http://danielsaidi.wordpress.com/2009/05/25/c-get-assembly-information/
19 | ///
20 | public static class AssemblyInfo
21 | {
22 | ///
23 | ///
24 | ///
25 | public static string versionFolderNumber;
26 |
27 | ///
28 | /// Title
29 | ///
30 | ///
31 | ///
32 | public static string Title
33 | {
34 | get
35 | {
36 | string result = string.Empty;
37 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
38 |
39 | if (assembly != null)
40 | {
41 | object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
42 | if ((customAttributes != null) && (customAttributes.Length > 0))
43 | result = ((AssemblyTitleAttribute)customAttributes[0]).Title;
44 | }
45 |
46 | return result;
47 | }
48 | }
49 |
50 | ///
51 | /// Description
52 | ///
53 | ///
54 | ///
55 | public static string Description
56 | {
57 | get
58 | {
59 | string result = string.Empty;
60 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
61 |
62 | if (assembly != null)
63 | {
64 | object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
65 | if ((customAttributes != null) && (customAttributes.Length > 0))
66 | result = ((AssemblyDescriptionAttribute)customAttributes[0]).Description;
67 | }
68 | return result;
69 | }
70 | }
71 |
72 | ///
73 | /// Company
74 | ///
75 | ///
76 | ///
77 | public static string Company
78 | {
79 | get
80 | {
81 | string result = string.Empty;
82 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
83 |
84 | if (assembly != null)
85 | {
86 | object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
87 | if ((customAttributes != null) && (customAttributes.Length > 0))
88 | result = ((AssemblyCompanyAttribute)customAttributes[0]).Company;
89 | }
90 |
91 | return result;
92 | }
93 | }
94 |
95 | ///
96 | /// Product
97 | ///
98 | ///
99 | ///
100 | public static string Product
101 | {
102 | get
103 | {
104 | string result = string.Empty;
105 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
106 |
107 | if (assembly != null)
108 | {
109 | object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
110 | if ((customAttributes != null) && (customAttributes.Length > 0))
111 | result = ((AssemblyProductAttribute)customAttributes[0]).Product;
112 | }
113 | return result;
114 | }
115 | }
116 |
117 | ///
118 | /// Copyright
119 | ///
120 | ///
121 | ///
122 | public static string Copyright
123 | {
124 | get
125 | {
126 | string result = string.Empty;
127 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
128 |
129 | if (assembly != null)
130 | {
131 | object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
132 | if ((customAttributes != null) && (customAttributes.Length > 0))
133 | result = ((AssemblyCopyrightAttribute)customAttributes[0]).Copyright;
134 | }
135 | return result;
136 | }
137 | }
138 |
139 | ///
140 | /// Trademark
141 | ///
142 | ///
143 | ///
144 | public static string Trademark
145 | {
146 | get
147 | {
148 | string result = string.Empty;
149 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
150 |
151 | if (assembly != null)
152 | {
153 | object[] customAttributes = assembly.GetCustomAttributes(typeof(AssemblyTrademarkAttribute), false);
154 | if ((customAttributes != null) && (customAttributes.Length > 0))
155 | result = ((AssemblyTrademarkAttribute)customAttributes[0]).Trademark;
156 | }
157 | return result;
158 | }
159 | }
160 |
161 | ///
162 | /// AssemblyVersion
163 | ///
164 | ///
165 | ///
166 | public static string AssemblyVersion
167 | {
168 | get
169 | {
170 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
171 | return assembly.GetName().Version.ToString();
172 | }
173 | }
174 |
175 | ///
176 | /// FileVersion
177 | ///
178 | ///
179 | ///
180 | public static string FileVersion
181 | {
182 | get
183 | {
184 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
185 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
186 | return fvi.FileVersion;
187 | }
188 | }
189 |
190 | ///
191 | /// Guid
192 | ///
193 | ///
194 | ///
195 | public static string Guid
196 | {
197 | get
198 | {
199 | string result = string.Empty;
200 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
201 |
202 | if (assembly != null)
203 | {
204 | object[] customAttributes = assembly.GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), false);
205 | if ((customAttributes != null) && (customAttributes.Length > 0))
206 | result = ((System.Runtime.InteropServices.GuidAttribute)customAttributes[0]).Value;
207 | }
208 | return result;
209 | }
210 | }
211 |
212 | ///
213 | /// FileName
214 | ///
215 | ///
216 | ///
217 | public static string FileName
218 | {
219 | get
220 | {
221 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
222 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
223 | return fvi.OriginalFilename;
224 | }
225 | }
226 |
227 | ///
228 | /// FilePath
229 | ///
230 | ///
231 | ///
232 | public static string FilePath
233 | {
234 | get
235 | {
236 | Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
237 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
238 | return fvi.FileName;
239 | }
240 | }
241 |
242 | ///
243 | /// Return the current file name (used for error logging)
244 | ///
245 | /// A method that returns a string of the current file name
246 | ///
247 | public static string GetCurrentFileName()
248 | {
249 | try
250 | {
251 | //return Globals.ThisAddIn.Application.ActiveWorkbook.Path + @"\" + Globals.ThisAddIn.Application.ActiveWorkbook.Name;
252 | return string.Empty;
253 | }
254 | catch (Exception)
255 | {
256 | return string.Empty;
257 | }
258 | }
259 |
260 | ///
261 | /// Returns the ClickOnce location
262 | ///
263 | /// A method that returns a string of the current location
264 | ///
265 | public static string GetClickOnceLocation()
266 | {
267 | try
268 | {
269 | System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly();
270 | Uri uriCodeBase = new Uri(assemblyInfo.CodeBase);
271 | return Path.GetDirectoryName(uriCodeBase.LocalPath.ToString());
272 |
273 | }
274 | catch (Exception)
275 | {
276 | return string.Empty;
277 |
278 | }
279 |
280 | }
281 |
282 | ///
283 | /// Returns the assembly location
284 | ///
285 | /// A method that returns a string of the current location
286 | ///
287 | public static string GetAssemblyLocation()
288 | {
289 | try
290 | {
291 | System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly();
292 | return assemblyInfo.Location;
293 |
294 | }
295 | catch (Exception)
296 | {
297 | return string.Empty;
298 |
299 | }
300 |
301 | }
302 |
303 | ///
304 | ///
305 | ///
306 | public static void SetAssemblyFolderVersion()
307 | {
308 | try
309 | {
310 | if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
311 | {
312 | Version ver = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion;
313 | string versionNumber = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
314 | versionFolderNumber = "_" + versionNumber.Replace(".", "_");
315 | }
316 | else
317 | {
318 | versionFolderNumber = "_" + FileVersion.Replace(".", "_");
319 | }
320 |
321 | }
322 | catch (Exception ex)
323 | {
324 | ErrorHandler.DisplayMessage(ex);
325 |
326 | }
327 | }
328 |
329 | ///
330 | /// set the icon in add/remove programs
331 | ///
332 | /// The referenced icon name for the application.
333 | ///
334 | /// only run if deployed
335 | ///
336 | public static void SetAddRemoveProgramsIcon(string iconName)
337 | {
338 | if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed
339 | && ApplicationDeployment.CurrentDeployment.IsFirstRun)
340 | {
341 | try
342 | {
343 | Assembly code = Assembly.GetExecutingAssembly();
344 | AssemblyDescriptionAttribute asdescription =
345 | (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(code, typeof(AssemblyDescriptionAttribute));
346 | string assemblyDescription = asdescription.Description;
347 |
348 | //Get the assembly information
349 | System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly();
350 |
351 | //CodeBase is the location of the ClickOnce deployment files
352 | Uri uriCodeBase = new Uri(assemblyInfo.CodeBase);
353 | string clickOnceLocation = Path.GetDirectoryName(uriCodeBase.LocalPath.ToString());
354 |
355 | //the icon is included in this program
356 | string iconSourcePath = Path.Combine(clickOnceLocation, @"Resources\" + iconName);
357 | if (!File.Exists(iconSourcePath))
358 | return;
359 |
360 | RegistryKey myUninstallKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");
361 | string[] mySubKeyNames = myUninstallKey.GetSubKeyNames();
362 | for (int i = 0; i < mySubKeyNames.Length; i++)
363 | {
364 | RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNames[i], true);
365 | object myValue = myKey.GetValue("DisplayName");
366 | if (myValue != null && myValue.ToString() == assemblyDescription)
367 | {
368 | myKey.SetValue("DisplayIcon", iconSourcePath);
369 | break;
370 | }
371 | }
372 | }
373 | catch (Exception ex)
374 | {
375 | ErrorHandler.DisplayMessage(ex);
376 | }
377 | }
378 | }
379 |
380 | ///
381 | /// Open a file as read only
382 | ///
383 | /// Represents the file path string
384 | ///
385 | public static void OpenFile(string filePath)
386 | {
387 | try
388 | {
389 | if (filePath == string.Empty)
390 | return;
391 | var attributes = File.GetAttributes(filePath);
392 | File.SetAttributes(filePath, attributes | FileAttributes.ReadOnly);
393 | System.Diagnostics.Process.Start(filePath);
394 |
395 | }
396 | catch (System.ComponentModel.Win32Exception)
397 | {
398 | MessageBox.Show("No application is assicated to this file type." + Environment.NewLine + Environment.NewLine + filePath, "No action taken.", MessageBoxButtons.OK, MessageBoxIcon.Information);
399 | return;
400 |
401 | }
402 | catch (Exception ex)
403 | {
404 | ErrorHandler.DisplayMessage(ex);
405 |
406 | }
407 |
408 | }
409 |
410 | }
411 | }
--------------------------------------------------------------------------------
/CS/Scripts/ErrorHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using System.Runtime.InteropServices;
4 | using log4net;
5 | using log4net.Config;
6 |
7 | [assembly: log4net.Config.XmlConfigurator(Watch = true)]
8 |
9 | //
10 | // This namespaces if for generic application classes
11 | //
12 | namespace ShapeExtract.Scripts
13 | {
14 | ///
15 | /// Used to handle exceptions
16 | ///
17 | public class ErrorHandler
18 | {
19 | private static readonly ILog log = LogManager.GetLogger(typeof(ErrorHandler));
20 |
21 | ///
22 | /// Used to produce an error message and create a log record
23 | ///
24 | ///
25 | /// ErrorHandler.DisplayMessage(ex);
26 | ///
27 | ///
28 | ///
29 | /// Represents errors that occur during application execution.
30 | ///
31 | public static void DisplayMessage(Exception ex)
32 | {
33 | System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1);
34 | System.Reflection.MethodBase caller = sf.GetMethod();
35 | string currentProcedure = (caller.Name).Trim();
36 | string errorMessageDescription = ex.ToString();
37 | errorMessageDescription = System.Text.RegularExpressions.Regex.Replace(errorMessageDescription, @"\r\n+", " "); //the carriage returns were messing up my log file
38 | string msg = "Contact your system administrator. A record has been created in the log file." + Environment.NewLine;
39 | msg += "Procedure: " + currentProcedure + Environment.NewLine;
40 | msg += "Description: " + ex.ToString() + Environment.NewLine;
41 | log.Error("[PROCEDURE]=|" + currentProcedure + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName + "|[DESCRIPTION]=|" + errorMessageDescription);
42 | MessageBox.Show(msg, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
43 | }
44 |
45 | ///
46 | ///
47 | ///
48 | ///
49 | ///
50 | ///
51 | public static string RemoveString(string text, string charValue = ".")
52 | {
53 | try
54 | {
55 | if (text.Contains(charValue))
56 | {
57 | return text.Substring(0, text.IndexOf("."));
58 | }
59 | else
60 | {
61 | return text;
62 | }
63 | }
64 | catch (Exception)
65 | {
66 | return text;
67 | }
68 | }
69 |
70 | ///
71 | ///
72 | ///
73 | ///
74 | ///
75 | public static string ValidateString(string text)
76 | {
77 | try
78 | {
79 | if (string.IsNullOrEmpty(text))
80 | {
81 | text = string.Empty;
82 | }
83 | else
84 | {
85 | text = string.Empty; //fix this
86 | //text = text.Replace(vbCr, "").Replace(vbLf, "");
87 | //text = text.Replace(",", ";");
88 | //text = text.Trim;
89 | }
90 |
91 | return text;
92 | }
93 | catch (Exception)
94 | {
95 | return text;
96 | }
97 |
98 | }
99 |
100 | }
101 | }
--------------------------------------------------------------------------------
/CS/Scripts/Ribbon_Buttons.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace ShapeExtract.Scripts
10 | {
11 | class Ribbon_Buttons
12 | {
13 |
14 | public static void ExportShapeValues()
15 | {
16 |
17 | }
18 |
19 | public static void OpenFile()
20 | {
21 | string filePath = Properties.Settings.Default.App_FileExport;
22 | try
23 | {
24 | if (filePath == string.Empty)
25 | return;
26 | var attributes = File.GetAttributes(filePath);
27 | File.SetAttributes(filePath, attributes | FileAttributes.ReadOnly);
28 | System.Diagnostics.Process.Start(filePath);
29 |
30 | }
31 | catch (System.ComponentModel.Win32Exception)
32 | {
33 | MessageBox.Show("No application is assicated to this file type." + Environment.NewLine + Environment.NewLine + filePath, "No action taken.", MessageBoxButtons.OK, MessageBoxIcon.Information);
34 | return;
35 |
36 | }
37 | catch (Exception ex)
38 | {
39 | ErrorHandler.DisplayMessage(ex);
40 |
41 | }
42 | }
43 |
44 | ///
45 | /// Opens the settings taskpane
46 | ///
47 | ///
48 | public static void OpenSettings()
49 | {
50 | try
51 | {
52 | //open settings form
53 |
54 | }
55 | catch (Exception ex)
56 | {
57 | ErrorHandler.DisplayMessage(ex);
58 | }
59 | }
60 |
61 | ///
62 | /// Opens an as built help file
63 | ///
64 | ///
65 | public static void OpenReadMe()
66 | {
67 | //ErrorHandler.CreateLogRecord();
68 | System.Diagnostics.Process.Start(Properties.Settings.Default.App_PathReadMe);
69 |
70 | }
71 |
72 | ///
73 | /// Opens an as built help file
74 | ///
75 | ///
76 | public static void OpenNewIssue()
77 | {
78 | //ErrorHandler.CreateLogRecord();
79 | System.Diagnostics.Process.Start(Properties.Settings.Default.App_PathReportIssue);
80 |
81 | }
82 |
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/CS/ShapeExtract.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 | {BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
23 | Debug
24 | AnyCPU
25 | {3B20570B-ED37-491D-82DC-D4B0E5D48607}
26 | Library
27 | false
28 | ShapeExtract
29 | ShapeExtract
30 | v4.5.2
31 | VSTO40
32 | true
33 | C:\Temp\
34 |
35 | en
36 | 1.0.0.0
37 | true
38 | true
39 | 7
40 | days
41 | False
42 | Visio Addin Shape Extract
43 | Anthony Duguid
44 |
45 | Visio Addin Shape Extract
46 |
47 | 3
48 |
49 |
50 |
51 | False
52 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29
53 | true
54 |
55 |
56 | False
57 | .NET Framework 3.5 SP1
58 | false
59 |
60 |
61 | False
62 | Microsoft Visual Studio 2010 Tools for Office Runtime %28x86 and x64%29
63 | true
64 |
65 |
66 | False
67 | Windows Installer 4.5
68 | true
69 |
70 |
71 |
72 |
76 | Visio
77 |
78 |
94 |
95 | true
96 | full
97 | false
98 | bin\Debug\
99 | false
100 | $(DefineConstants);DEBUG;TRACE
101 | 4
102 |
103 |
119 |
120 | pdbonly
121 | true
122 | bin\Release\
123 | false
124 | $(DefineConstants);TRACE
125 | 4
126 |
127 |
130 |
131 |
132 |
133 | packages\log4net.2.0.8\lib\net45-full\log4net.dll
134 | True
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 | True
156 |
157 |
158 |
159 |
160 | False
161 | true
162 |
163 |
164 | False
165 | true
166 |
167 |
168 | False
169 |
170 |
171 |
181 |
182 |
183 | Code
184 |
185 |
186 | ResXFileCodeGenerator
187 | Resources.Designer.cs
188 | Designer
189 |
190 |
191 | True
192 | Resources.resx
193 | True
194 |
195 |
196 |
197 |
198 |
199 | SettingsSingleFileGenerator
200 | Settings.Designer.cs
201 |
202 |
203 | True
204 | Settings.settings
205 | True
206 |
207 |
208 |
209 |
210 |
211 |
212 | Code
213 |
214 |
215 | ThisAddIn.cs
216 |
217 |
218 | ThisAddIn.Designer.xml
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 | 10.0
236 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
237 |
238 |
239 | true
240 |
241 |
242 | AnthonyDuguid.pfx
243 |
244 |
245 | 93965FE7740536E96E341C481EEBCAF9BF3BD295
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
--------------------------------------------------------------------------------
/CS/ShapeExtract.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShapeExtract", "ShapeExtract.csproj", "{3B20570B-ED37-491D-82DC-D4B0E5D48607}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {3B20570B-ED37-491D-82DC-D4B0E5D48607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {3B20570B-ED37-491D-82DC-D4B0E5D48607}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {3B20570B-ED37-491D-82DC-D4B0E5D48607}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {3B20570B-ED37-491D-82DC-D4B0E5D48607}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/CS/ThisAddIn.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | #pragma warning disable 414
12 | namespace ShapeExtract {
13 |
14 |
15 | ///
16 | [Microsoft.VisualStudio.Tools.Applications.Runtime.StartupObjectAttribute(0)]
17 | [global::System.Security.Permissions.PermissionSetAttribute(global::System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
18 | public sealed partial class ThisAddIn : Microsoft.Office.Tools.AddInBase {
19 |
20 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
21 | private global::System.Object missing = global::System.Type.Missing;
22 |
23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
24 | internal Microsoft.Office.Interop.Visio.Application Application;
25 |
26 | ///
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
29 | public ThisAddIn(global::Microsoft.Office.Tools.Factory factory, global::System.IServiceProvider serviceProvider) :
30 | base(factory, serviceProvider, "AddIn", "ThisAddIn") {
31 | Globals.Factory = factory;
32 | }
33 |
34 | ///
35 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
36 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
38 | protected override void Initialize() {
39 | base.Initialize();
40 | this.Application = this.GetHostItem(typeof(Microsoft.Office.Interop.Visio.Application), "Application");
41 | Globals.ThisAddIn = this;
42 | global::System.Windows.Forms.Application.EnableVisualStyles();
43 | this.InitializeCachedData();
44 | this.InitializeControls();
45 | this.InitializeComponents();
46 | this.InitializeData();
47 | }
48 |
49 | ///
50 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
51 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
53 | protected override void FinishInitialization() {
54 | this.InternalStartup();
55 | this.OnStartup();
56 | }
57 |
58 | ///
59 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
60 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
61 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
62 | protected override void InitializeDataBindings() {
63 | this.BeginInitialization();
64 | this.BindToData();
65 | this.EndInitialization();
66 | }
67 |
68 | ///
69 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
70 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
71 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
72 | private void InitializeCachedData() {
73 | if ((this.DataHost == null)) {
74 | return;
75 | }
76 | if (this.DataHost.IsCacheInitialized) {
77 | this.DataHost.FillCachedData(this);
78 | }
79 | }
80 |
81 | ///
82 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
83 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
84 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
85 | private void InitializeData() {
86 | }
87 |
88 | ///
89 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
90 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
91 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
92 | private void BindToData() {
93 | }
94 |
95 | ///
96 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
97 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
98 | private void StartCaching(string MemberName) {
99 | this.DataHost.StartCaching(this, MemberName);
100 | }
101 |
102 | ///
103 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
104 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
105 | private void StopCaching(string MemberName) {
106 | this.DataHost.StopCaching(this, MemberName);
107 | }
108 |
109 | ///
110 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
111 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
112 | private bool IsCached(string MemberName) {
113 | return this.DataHost.IsCached(this, MemberName);
114 | }
115 |
116 | ///
117 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
118 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
119 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
120 | private void BeginInitialization() {
121 | this.BeginInit();
122 | }
123 |
124 | ///
125 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
126 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
127 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
128 | private void EndInitialization() {
129 | this.EndInit();
130 | }
131 |
132 | ///
133 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
134 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
135 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
136 | private void InitializeControls() {
137 | }
138 |
139 | ///
140 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
141 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
142 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
143 | private void InitializeComponents() {
144 | }
145 |
146 | ///
147 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
148 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
149 | private bool NeedsFill(string MemberName) {
150 | return this.DataHost.NeedsFill(this, MemberName);
151 | }
152 | }
153 |
154 | ///
155 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
156 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
157 | internal sealed partial class Globals {
158 |
159 | ///
160 | private Globals() {
161 | }
162 |
163 | private static ThisAddIn _ThisAddIn;
164 |
165 | private static global::Microsoft.Office.Tools.Factory _factory;
166 |
167 | private static ThisRibbonCollection _ThisRibbonCollection;
168 |
169 | internal static ThisAddIn ThisAddIn {
170 | get {
171 | return _ThisAddIn;
172 | }
173 | set {
174 | if ((_ThisAddIn == null)) {
175 | _ThisAddIn = value;
176 | }
177 | else {
178 | throw new System.NotSupportedException();
179 | }
180 | }
181 | }
182 |
183 | internal static global::Microsoft.Office.Tools.Factory Factory {
184 | get {
185 | return _factory;
186 | }
187 | set {
188 | if ((_factory == null)) {
189 | _factory = value;
190 | }
191 | else {
192 | throw new System.NotSupportedException();
193 | }
194 | }
195 | }
196 |
197 | internal static ThisRibbonCollection Ribbons {
198 | get {
199 | if ((_ThisRibbonCollection == null)) {
200 | _ThisRibbonCollection = new ThisRibbonCollection(_factory.GetRibbonFactory());
201 | }
202 | return _ThisRibbonCollection;
203 | }
204 | }
205 | }
206 |
207 | ///
208 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
209 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
210 | internal sealed partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonCollectionBase {
211 |
212 | ///
213 | internal ThisRibbonCollection(global::Microsoft.Office.Tools.Ribbon.RibbonFactory factory) :
214 | base(factory) {
215 | }
216 | }
217 | }
218 |
--------------------------------------------------------------------------------
/CS/ThisAddIn.Designer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/CS/ThisAddIn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Xml.Linq;
6 | using Visio = Microsoft.Office.Interop.Visio;
7 | using Office = Microsoft.Office.Core;
8 |
9 | namespace ShapeExtract
10 | {
11 | public partial class ThisAddIn
12 | {
13 | private void ThisAddIn_Startup(object sender, System.EventArgs e)
14 | {
15 | }
16 |
17 | private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
18 | {
19 | }
20 |
21 | ///
22 | /// This method is used to create the ribbon
23 | ///
24 | ///
25 | protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
26 | {
27 | return new Ribbon();
28 | }
29 |
30 | #region VSTO generated code
31 |
32 | ///
33 | /// Required method for Designer support - do not modify
34 | /// the contents of this method with the code editor.
35 | ///
36 | private void InternalStartup()
37 | {
38 | this.Startup += new System.EventHandler(ThisAddIn_Startup);
39 | this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
40 | }
41 |
42 | #endregion
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/CS/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | C:\Temp
18 |
19 |
20 | https://github.com/Office-projects/VisioShapeExtract/blob/master/README.md
21 |
22 |
23 | https://github.com/Office-projects/VisioShapeExtract/issues/new
24 |
25 |
26 | 07/31/2017 13:05:00
27 |
28 |
29 |
30 |
31 |
32 |
33 | Anthony Duguid
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/CS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Images/ReadMe/header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/Images/ReadMe/header.png
--------------------------------------------------------------------------------
/Images/ReadMe/header.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/Images/ReadMe/header.pptx
--------------------------------------------------------------------------------
/Images/ReadMe/header_footer.vsdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/Images/ReadMe/header_footer.vsdx
--------------------------------------------------------------------------------
/Images/ReadMe/ribbon.group.about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/Images/ReadMe/ribbon.group.about.png
--------------------------------------------------------------------------------
/Images/ReadMe/ribbon.group.help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/Images/ReadMe/ribbon.group.help.png
--------------------------------------------------------------------------------
/Images/ReadMe/vsto.ribbon.settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/Images/ReadMe/vsto.ribbon.settings.png
--------------------------------------------------------------------------------
/Images/ReadMe/vsto.visio.shape.extract.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/Images/ReadMe/vsto.visio.shape.extract.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Anthony Duguid
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | This Add-In extracts the shape attributes' text from a Microsoft Visio file.
6 |
7 | VB.NET & VBA versions included :new: I'm currently working on the C# version.
8 |
9 | [](https://www.paypal.me/AnthonyDuguid/1.00)
10 | [](https://gitter.im/MicrosoftVisioShapeExtract/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
11 | [](LICENSE "MIT License Copyright © Anthony Duguid")
12 | [](https://github.com/Visio-projects/Visio-Shape-Extract/releases)
13 | [](https://github.com/Visio-projects/Visio-Shape-Extract)
14 | [](https://github.com/Visio-projects/Visio-Shape-Extract/issues)
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | ## Table of Contents
24 | - Install
25 | - Dependencies
26 | - Glossary of Terms
27 | - Functionality
28 | - Actions
29 | - Options
30 | - Help
31 | - About
32 |
33 |
34 |
35 |
36 | ## Install
37 | Instructions for installation of VBA and VSTO versions.
38 |
39 | ### VBA
40 | How to install the VBA version
41 | 1. Download the VBA Add-In file [](https://github.com/Office-projects/VisioShapeExtract/raw/master/VBA/ShapeExtract.vsdm?raw=true "Download the VBA Add-In").
42 |
43 | ### VSTO
44 | How to install the VSTO version
45 | 1. Download AnthonyDuguid.pfx And Install At Root Level [](https://github.com/Visio-projects/Visio-Shape-Extract/VB/blob/master/AnthonyDuguid.pfx?raw=true "Download AnthonyDuguid.pfx And Install At Root Level For VSTO")
46 | 2. Download and run the setup.exe file. ```TODO: publish .NET to GitHub```
47 |
50 |
51 |
52 |
53 |
54 | ## Dependencies
55 | |Software |Dependency |Project |
56 | |:------------------------------------------|:--------------------------|:--------------------------|
57 | |[Microsoft Visual Studio](https://www.visualstudio.com/vs/whatsnew/)|Solution|VSTO|
58 | |[Microsoft Office Developer Tools](https://visualstudio.microsoft.com/vs/features/office-tools/)|Solution|VSTO|
59 | |[Microsoft Visio](https://www.microsoft.com/en-au/software-download/office)|Project|VBA, VSTO|
60 | |[Visual Basic for Applications](https://msdn.microsoft.com/en-us/vba/vba-language-reference)|Code|VBA|
61 | |[Extensible Markup Language (XML)](https://www.rondebruin.nl/win/s2/win001.htm)|Ribbon|VBA, VSTO|
62 | |[Snagit](http://discover.techsmith.com/snagit-non-brand-desktop/?gclid=CNzQiOTO09UCFVoFKgod9EIB3g)|Read Me|VBA, VSTO|
63 | |Badges ([Library](https://shields.io/), [Custom](https://rozaxe.github.io/factory/), [Star/Fork](http://githubbadges.com))|Read Me|VBA, VSTO|
64 |
65 |
66 |
67 |
68 | ## Glossary of Terms
69 |
70 | | Term | Meaning |
71 | |:--------------------------|:-----------------------------------------------------------------------------------------|
72 | | COM |Component Object Model (COM) is a binary-interface standard for software components introduced by Microsoft in 1993. It is used to enable inter-process communication and dynamic object creation in a large range of programming languages. COM is the basis for several other Microsoft technologies and frameworks, including OLE, OLE Automation, ActiveX, COM+, DCOM, the Windows shell, DirectX, UMDF and Windows Runtime. |
73 | | VBA |Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic 6 and uses the Visual Basic Runtime Library. However, VBA code normally can only run within a host application, rather than as a standalone program. VBA can, however, control one application from another using OLE Automation. VBA can use, but not create, ActiveX/COM DLLs, and later versions add support for class modules.|
74 | | VSTO |Visual Studio Tools for Office (VSTO) is a set of development tools available in the form of a Visual Studio add-in (project templates) and a runtime that allows Microsoft Office 2003 and later versions of Office applications to host the .NET Framework Common Language Runtime (CLR) to expose their functionality via .NET.|
75 | | XML|Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.The design goals of XML emphasize simplicity, generality, and usability across the Internet. It is a textual data format with strong support via Unicode for different human languages. Although the design of XML focuses on documents, the language is widely used for the representation of arbitrary data structures such as those used in web services.|
76 |
77 |
78 |
79 | ## Functionality
80 | This Visio ribbon named “Shape Extract” is inserted after the “Home” tab when Visio opens. Listed below is the detailed functionality of this application and its components.
81 |
82 |
83 | ### Actions (Group)
84 |
85 | #### Export Shapes (Button)
86 | * Exports all the attribute values from each shape to a .csv file
87 |
88 | #### Open Folder (Button)
89 | * Opens the export folder
90 |
91 | #### Open File (Button)
92 | * Open the export file
93 |
94 |
95 | ### Options (Group)
96 |
97 | #### Add-In Settings (Button)
98 |
99 |
100 | VSTO
101 |
102 |
103 |
104 |
105 | - Types of VSTO Settings
106 | - Application Settings
107 | - These settings can only be changed in the project and need to be redeployed
108 | - They will appear disabled in the form
109 | - User Settings
110 | - These settings can be changed by the end-user
111 | - They will appear enabled in the form
112 |
113 |
114 | ### Help (Group)
115 |
116 |
117 |
118 |
119 |
120 | #### How To... (Button)
121 | * Opens the how to guide in a browser
122 |
123 |
124 | #### Report Issue (Button)
125 | * Opens the new issue page in a browser
126 |
127 |
128 | #### New Version Is Available (Button)
129 | * This button is visible if the version of the Add-In is different from the one in the Read Me page. It will download a new version from the site when pressed.
130 |
131 |
132 | ### About (Group)
133 |
134 |
135 |
136 |
137 |
138 |
139 | #### Add-in Name (Label)
140 | * The application name with the version
141 |
142 |
143 | #### Release Date (Label)
144 | * The release date of the application
145 |
146 |
147 | #### Copyright (Label)
148 | * The author’s name
149 |
--------------------------------------------------------------------------------
/VB/AnthonyDuguid.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VB/AnthonyDuguid.pfx
--------------------------------------------------------------------------------
/VB/Forms/Settings.designer.vb:
--------------------------------------------------------------------------------
1 | Namespace Forms
2 |
3 | _
4 | Partial Class Settings
5 | Inherits System.Windows.Forms.Form
6 |
7 | 'Form overrides dispose to clean up the component list.
8 | _
9 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
10 | Try
11 | If disposing AndAlso components IsNot Nothing Then
12 | components.Dispose()
13 | End If
14 | Finally
15 | MyBase.Dispose(disposing)
16 | End Try
17 | End Sub
18 |
19 | 'Required by the Windows Form Designer
20 | Private components As System.ComponentModel.IContainer
21 |
22 | 'NOTE: The following procedure is required by the Windows Form Designer
23 | 'It can be modified using the Windows Form Designer.
24 | 'Do not modify it using the code editor.
25 | _
26 | Private Sub InitializeComponent()
27 | Me.pgdSettings = New System.Windows.Forms.PropertyGrid()
28 | Me.SuspendLayout()
29 | '
30 | 'pgdSettings
31 | '
32 | Me.pgdSettings.Dock = System.Windows.Forms.DockStyle.Fill
33 | Me.pgdSettings.Location = New System.Drawing.Point(0, 0)
34 | Me.pgdSettings.Name = "pgdSettings"
35 | Me.pgdSettings.Size = New System.Drawing.Size(586, 416)
36 | Me.pgdSettings.TabIndex = 0
37 | '
38 | 'frmSettings
39 | '
40 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
41 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
42 | Me.ClientSize = New System.Drawing.Size(586, 416)
43 | Me.Controls.Add(Me.pgdSettings)
44 | Me.Name = "frmSettings"
45 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
46 | Me.Text = "frmSettings"
47 | Me.ResumeLayout(False)
48 |
49 | End Sub
50 | Friend WithEvents pgdSettings As System.Windows.Forms.PropertyGrid
51 | End Class
52 |
53 | End Namespace
54 |
--------------------------------------------------------------------------------
/VB/Forms/Settings.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/VB/Forms/Settings.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | Imports System.Windows.Forms
5 | Imports System.Reflection
6 | Imports ShapeExtract.Scripts
7 |
8 | Namespace Forms
9 |
10 | Public Class Settings
11 |
12 | Private Sub FrmSettingsLoad(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
13 | Try
14 | Me.pgdSettings.SelectedObject = My.Settings
15 | SetLabelColumnWidth(Me.pgdSettings, 200)
16 | AssemblyInfo.SetFormIcon(Me, My.Resources.Settings)
17 | Me.Text = "Settings for " & My.Application.Info.Title.ToString.Replace("&", "&&") & Space(1)
18 |
19 | Catch ex As Exception
20 | ErrorHandler.DisplayMessage(ex)
21 | Exit Try
22 |
23 | End Try
24 |
25 | End Sub
26 |
27 | Private Sub FrmSettingsFormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
28 | Try
29 | My.Settings.Save()
30 |
31 | Catch ex As Exception
32 | ErrorHandler.DisplayMessage(ex)
33 | Exit Try
34 |
35 | End Try
36 |
37 | End Sub
38 |
39 | Public Sub SetLabelColumnWidth(grid As PropertyGrid, width As Integer)
40 | Try
41 |
42 | If grid Is Nothing Then
43 | Return
44 | End If
45 |
46 | Dim fi As FieldInfo = grid.[GetType]().GetField("gridView", BindingFlags.Instance Or BindingFlags.NonPublic)
47 | If fi Is Nothing Then
48 | Return
49 | End If
50 |
51 | Dim view As Control = TryCast(fi.GetValue(grid), Control)
52 | If view Is Nothing Then
53 | Return
54 | End If
55 |
56 | Dim mi As MethodInfo = view.[GetType]().GetMethod("MoveSplitterTo", BindingFlags.Instance Or BindingFlags.NonPublic)
57 | If mi Is Nothing Then
58 | Return
59 | End If
60 | mi.Invoke(view, New Object() {width})
61 |
62 | Catch ex As Exception
63 | ErrorHandler.DisplayMessage(ex)
64 | Exit Try
65 |
66 | End Try
67 | End Sub
68 |
69 | End Class
70 |
71 | End Namespace
--------------------------------------------------------------------------------
/VB/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 | 'Imports System.Security
5 |
6 | ' General Information about an assembly is controlled through the following
7 | ' set of attributes. Change these attribute values to modify the information
8 | ' associated with an assembly.
9 |
10 | ' Review the values of the assembly attributes
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | ' Setting ComVisible to false makes the types in this assembly not visible
20 | ' to COM components. If you need to access a type in this assembly from
21 | ' COM, set the ComVisible attribute to true on that type.
22 |
23 |
24 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
25 |
26 |
27 | ' Version information for an assembly consists of the following four values:
28 | '
29 | ' Major Version
30 | ' Minor Version
31 | ' Build Number
32 | ' Revision
33 | '
34 | ' You can specify all the values or you can default the Build and Revision Numbers
35 | ' by using the '*' as shown below:
36 | '
37 |
38 |
39 |
40 |
41 | Friend Module DesignTimeConstants
42 | Public Const RibbonTypeSerializer As String = "Microsoft.VisualStudio.Tools.Office.Ribbon.Serialization.RibbonTypeCodeDomSerializer, Microsoft.VisualStudio.Tools.Office.Designer, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
43 | Public Const RibbonBaseTypeSerializer As String = "System.ComponentModel.Design.Serialization.TypeCodeDomSerializer, System.Design"
44 | Public Const RibbonDesigner As String = "Microsoft.VisualStudio.Tools.Office.Ribbon.Design.RibbonDesigner, Microsoft.VisualStudio.Tools.Office.Designer, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
45 | End Module
46 |
--------------------------------------------------------------------------------
/VB/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ShapeExtract.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 |
63 | '''
64 | ''' Looks up a localized resource of type System.Drawing.Bitmap.
65 | '''
66 | Friend ReadOnly Property Settings() As System.Drawing.Bitmap
67 | Get
68 | Dim obj As Object = ResourceManager.GetObject("Settings", resourceCulture)
69 | Return CType(obj,System.Drawing.Bitmap)
70 | End Get
71 | End Property
72 |
73 | '''
74 | ''' Looks up a localized resource of type System.Drawing.Bitmap.
75 | '''
76 | Friend ReadOnly Property VisioAddin() As System.Drawing.Bitmap
77 | Get
78 | Dim obj As Object = ResourceManager.GetObject("VisioAddin", resourceCulture)
79 | Return CType(obj,System.Drawing.Bitmap)
80 | End Get
81 | End Property
82 | End Module
83 | End Namespace
84 |
--------------------------------------------------------------------------------
/VB/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\Settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
125 | ..\Resources\VisioAddin.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
126 |
127 |
--------------------------------------------------------------------------------
/VB/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 |
16 | _
19 | Partial Friend NotInheritable Class MySettings
20 | Inherits Global.System.Configuration.ApplicationSettingsBase
21 |
22 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
23 |
24 | #Region "My.Settings Auto-Save Functionality"
25 | #If _MyType = "WindowsForms" Then
26 | Private Shared addedHandler As Boolean
27 |
28 | Private Shared addedHandlerLockObject As New Object
29 |
30 | _
31 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
32 | If My.Application.SaveMySettingsOnExit Then
33 | My.Settings.Save()
34 | End If
35 | End Sub
36 | #End If
37 | #End Region
38 |
39 | Public Shared ReadOnly Property [Default]() As MySettings
40 | Get
41 |
42 | #If _MyType = "WindowsForms" Then
43 | If Not addedHandler Then
44 | SyncLock addedHandlerLockObject
45 | If Not addedHandler Then
46 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
47 | addedHandler = True
48 | End If
49 | End SyncLock
50 | End If
51 | #End If
52 | Return defaultInstance
53 | End Get
54 | End Property
55 |
56 | _
59 | Public ReadOnly Property App_Author() As String
60 | Get
61 | Return CType(Me("App_Author"),String)
62 | End Get
63 | End Property
64 |
65 | _
68 | Public Property App_PathExportLocation() As String
69 | Get
70 | Return CType(Me("App_PathExportLocation"),String)
71 | End Get
72 | Set
73 | Me("App_PathExportLocation") = value
74 | End Set
75 | End Property
76 |
77 | _
80 | Public Property App_FileExport() As String
81 | Get
82 | Return CType(Me("App_FileExport"),String)
83 | End Get
84 | Set
85 | Me("App_FileExport") = value
86 | End Set
87 | End Property
88 |
89 | _
92 | Public Property App_PathReadMe() As String
93 | Get
94 | Return CType(Me("App_PathReadMe"),String)
95 | End Get
96 | Set
97 | Me("App_PathReadMe") = value
98 | End Set
99 | End Property
100 |
101 | _
104 | Public Property App_PathReportIssue() As String
105 | Get
106 | Return CType(Me("App_PathReportIssue"),String)
107 | End Get
108 | Set
109 | Me("App_PathReportIssue") = value
110 | End Set
111 | End Property
112 |
113 | _
116 | Public Property App_ReleaseDate() As Date
117 | Get
118 | Return CType(Me("App_ReleaseDate"),Date)
119 | End Get
120 | Set
121 | Me("App_ReleaseDate") = value
122 | End Set
123 | End Property
124 | End Class
125 |
126 | Namespace My
127 |
128 | _
131 | Friend Module MySettingsProperty
132 |
133 | _
134 | Friend ReadOnly Property Settings() As Global.ShapeExtract.MySettings
135 | Get
136 | Return Global.ShapeExtract.MySettings.Default
137 | End Get
138 | End Property
139 | End Module
140 | End Namespace
141 |
--------------------------------------------------------------------------------
/VB/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Anthony Duguid
7 |
8 |
9 | C:\Temp
10 |
11 |
12 |
13 |
14 |
15 | https://github.com/aduguid/MicrosoftVisioShapeExtract/blob/master/README.md
16 |
17 |
18 | https://github.com/aduguid/MicrosoftVisioShapeExtract/issues/new
19 |
20 |
21 | 07/31/2017 13:05:00
22 |
23 |
24 |
--------------------------------------------------------------------------------
/VB/Resources/GroupInfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VB/Resources/GroupInfo.png
--------------------------------------------------------------------------------
/VB/Resources/HelpApi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VB/Resources/HelpApi.png
--------------------------------------------------------------------------------
/VB/Resources/HelpAsBuilt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VB/Resources/HelpAsBuilt.png
--------------------------------------------------------------------------------
/VB/Resources/HelpEmail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VB/Resources/HelpEmail.png
--------------------------------------------------------------------------------
/VB/Resources/Settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VB/Resources/Settings.png
--------------------------------------------------------------------------------
/VB/Resources/VisioAddin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VB/Resources/VisioAddin.png
--------------------------------------------------------------------------------
/VB/Ribbon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/VB/Scripts/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | Imports Microsoft.Win32
5 | Imports System.Deployment.Application
6 | Imports System.Drawing
7 | Imports System.IO
8 | Imports System.Reflection
9 | Imports System.Windows.Forms
10 |
11 | Namespace Scripts
12 |
13 | Public Class AssemblyInfo
14 |
15 | Public Shared Sub SetFormIcon(ByRef currentForm As Form, ByRef bmp As Bitmap)
16 | Try
17 | currentForm.Icon = Icon.FromHandle(bmp.GetHicon)
18 |
19 | Catch ex As Exception
20 | ErrorHandler.DisplayMessage(ex)
21 | Exit Try
22 |
23 | End Try
24 |
25 | End Sub
26 |
27 | Public Shared Sub SetAddRemoveProgramsIcon(iconName As String)
28 | If System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed AndAlso ApplicationDeployment.CurrentDeployment.IsFirstRun Then
29 | Try
30 | Dim code As Assembly = Assembly.GetExecutingAssembly()
31 | Dim asdescription As AssemblyDescriptionAttribute = DirectCast(Attribute.GetCustomAttribute(code, GetType(AssemblyDescriptionAttribute)), AssemblyDescriptionAttribute)
32 | Dim assemblyDescription As String = asdescription.Description
33 |
34 | 'Get the assembly information
35 | Dim assemblyInfo As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
36 |
37 | 'CodeBase is the location of the ClickOnce deployment files
38 | Dim uriCodeBase As New Uri(assemblyInfo.CodeBase)
39 | Dim clickOnceLocation As String = Path.GetDirectoryName(uriCodeBase.LocalPath.ToString())
40 |
41 | 'the icon is included in this program
42 | Dim iconSourcePath As String = Path.Combine(clickOnceLocation, Convert.ToString("Resources\") & iconName)
43 | If Not File.Exists(iconSourcePath) Then
44 | Return
45 | End If
46 |
47 | Dim myUninstallKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Uninstall")
48 | Dim mySubKeyNames As String() = myUninstallKey.GetSubKeyNames()
49 | For i As Integer = 0 To mySubKeyNames.Length - 1
50 | Dim myKey As RegistryKey = myUninstallKey.OpenSubKey(mySubKeyNames(i), True)
51 | Dim myValue As Object = myKey.GetValue("DisplayName")
52 | If myValue IsNot Nothing AndAlso myValue.ToString() = assemblyDescription Then
53 | myKey.SetValue("DisplayIcon", iconSourcePath)
54 | Exit For
55 | End If
56 | Next
57 | Catch ex As Exception
58 | ErrorHandler.DisplayMessage(ex)
59 | End Try
60 | End If
61 | End Sub
62 |
63 | Public Shared Function GetCurrentLocation(locationType As String) As String
64 | Try
65 | Dim assemblyInfo As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
66 | Dim uriCodeBase As New Uri(assemblyInfo.CodeBase)
67 |
68 | Select Case locationType
69 | Case "AssemblyLocation"
70 | Return assemblyInfo.Location
71 | Case "ClickOnceLocation"
72 | Return Path.GetDirectoryName(uriCodeBase.LocalPath.ToString())
73 | Case Else
74 | Return String.Empty
75 |
76 | End Select
77 | Catch generatedExceptionName As Exception
78 |
79 | Return String.Empty
80 | End Try
81 |
82 | End Function
83 |
84 | End Class
85 |
86 | End Namespace
87 |
--------------------------------------------------------------------------------
/VB/Scripts/ErrorHandler.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | Imports System.Environment
5 | Imports System.Windows.Forms
6 |
7 | Namespace Scripts
8 |
9 | Public Class ErrorHandler
10 |
11 | Public Shared Sub DisplayMessage(ex As Exception)
12 | Dim sf As New System.Diagnostics.StackFrame(1)
13 | Dim caller As System.Reflection.MethodBase = sf.GetMethod()
14 | Dim currentProcedure As String = (caller.Name).Trim()
15 | Dim currentFileName As String = "" 'AssemblyInfo.GetCurrentFileName()
16 | Dim errorMessageDescription As String = ex.ToString()
17 | errorMessageDescription = System.Text.RegularExpressions.Regex.Replace(errorMessageDescription, "\r\n+", " ")
18 | Dim msg As String = "Contact your system administrator. A record has been created in the log file." + Environment.NewLine
19 | msg += (Convert.ToString("Procedure: ") & currentProcedure) + Environment.NewLine
20 | msg += "Description: " + ex.ToString() + Environment.NewLine
21 | MessageBox.Show(msg, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
22 |
23 | End Sub
24 |
25 | Public Shared Function RemoveString(ByVal text As String, Optional ByVal charValue As String = ".") As String
26 | Try
27 | If text.Contains(charValue) Then
28 | Return text.Substring(0, text.IndexOf("."))
29 | Else
30 | Return text
31 | End If
32 |
33 | Catch ex As Exception
34 | Return text
35 |
36 | Finally
37 |
38 | End Try
39 |
40 | End Function
41 |
42 | Public Shared Function ValidateString(ByVal text As String) As String
43 | Try
44 | If String.IsNullOrEmpty(text) Then
45 | text = String.Empty
46 | Else
47 | text = text.Replace(vbCr, "").Replace(vbLf, "")
48 | text = text.Replace(",", ";")
49 | text = text.Trim
50 | End If
51 | Return text
52 |
53 | Catch ex As Exception
54 | Return text
55 |
56 | Finally
57 |
58 | End Try
59 |
60 | End Function
61 |
62 | End Class
63 |
64 | End Namespace
65 |
--------------------------------------------------------------------------------
/VB/Scripts/Ribbon_Buttons.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | Imports System.IO
5 |
6 | Namespace Scripts
7 |
8 | Public Class Ribbon_Buttons
9 |
10 | Public Shared Sub ExportShapeValues()
11 | Dim outFile As StreamWriter = Nothing
12 | Try
13 | Dim shape As Visio.Shape
14 | Dim cell As Visio.Cell
15 | Dim nRows As Short = 0
16 | Dim i As Short = 0
17 | Dim shpNo As Integer = 0
18 | Dim promptName As String = String.Empty
19 | Dim cellName As String = String.Empty
20 | Dim cellValue As String = String.Empty
21 | Dim line As String = String.Empty
22 |
23 | If Globals.ThisAddIn.Application.ActiveDocument IsNot Nothing Then
24 | Exit Try
25 | End If
26 |
27 | Dim fileName As String = My.Settings.App_PathExportLocation & "\" & Globals.ThisAddIn.Application.ActiveDocument.Name.ToString & "_exported_" & System.DateTime.Now().ToString("yyyyMMdd_hhmmss") & ".csv"
28 | outFile = My.Computer.FileSystem.OpenTextFileWriter(fileName, False, System.Text.Encoding.Default)
29 |
30 | outFile.WriteLine("Shape Type, Shape ID, Shape Name, Cell Name, Prompt Name, Cell Value, Label Text")
31 | For shpNo = 1 To Globals.ThisAddIn.Application.ActivePage.Shapes.Count
32 | shape = Globals.ThisAddIn.Application.ActivePage.Shapes(shpNo)
33 | nRows = shape.RowCount(CShort(Visio.VisSectionIndices.visSectionProp))
34 | For i = 0 To CShort(nRows - 1)
35 | cell = shape.CellsSRC(CShort(Visio.VisSectionIndices.visSectionProp), i, 0)
36 | cellValue = cell.ResultStr(Visio.VisSectionIndices.visSectionNone)
37 | cell = shape.CellsSRC(CShort(Visio.VisSectionIndices.visSectionProp), i, 1)
38 | promptName = cell.ResultStr(Visio.VisSectionIndices.visSectionNone)
39 | cell = shape.CellsSRC(CShort(Visio.VisSectionIndices.visSectionProp), i, 2)
40 | cellName = cell.ResultStr(Visio.VisSectionIndices.visSectionNone)
41 | line = ErrorHandler.RemoveString(shape.Name.ToString, ".") & ", " & ErrorHandler.ValidateString(shape.ID.ToString) & ", " & ErrorHandler.ValidateString(shape.Name.ToString) & ", " & ErrorHandler.ValidateString(cellName) & ", " & ErrorHandler.ValidateString(promptName) & ", " & ErrorHandler.ValidateString(cellValue) & ", " & ErrorHandler.ValidateString(shape.Text.ToString)
42 | outFile.WriteLine(line)
43 | Next i
44 | Next shpNo
45 | My.Settings.App_FileExport = fileName
46 |
47 | Catch ex As Exception
48 | ErrorHandler.DisplayMessage(ex)
49 |
50 | Finally
51 | outFile.Close()
52 |
53 | End Try
54 |
55 | End Sub
56 |
57 | Public Shared Sub OpenFile(ByVal fileName As String)
58 | Try
59 | Dim pStart As New System.Diagnostics.Process
60 | If fileName = String.Empty Then Exit Try
61 | pStart.StartInfo.FileName = fileName
62 | pStart.Start()
63 |
64 | Catch ex As System.ComponentModel.Win32Exception
65 | Exit Try
66 |
67 | Catch ex As Exception
68 | ErrorHandler.DisplayMessage(ex)
69 | Exit Try
70 |
71 | End Try
72 |
73 | End Sub
74 |
75 | Public Shared Sub OpenReadMe()
76 | System.Diagnostics.Process.Start(My.Settings.App_PathReadMe)
77 | End Sub
78 |
79 | Public Shared Sub OpenNewIssue()
80 | System.Diagnostics.Process.Start(My.Settings.App_PathReportIssue)
81 |
82 | End Sub
83 |
84 | Public Shared Sub OpenSettings()
85 | Try
86 | Dim formSettings As New Forms.Settings
87 | formSettings.ShowDialog()
88 | Scripts.Ribbon.ribbonref.InvalidateRibbon()
89 |
90 | Catch ex As Exception
91 | ErrorHandler.DisplayMessage(ex)
92 |
93 | End Try
94 |
95 | End Sub
96 |
97 | End Class
98 |
99 | End Namespace
--------------------------------------------------------------------------------
/VB/Scripts/Ribbon_Events.vb:
--------------------------------------------------------------------------------
1 | Option Strict On
2 | Option Explicit On
3 |
4 | Imports System.Windows.Forms
5 |
6 | Namespace Scripts
7 |
8 |
9 | Public Class Ribbon
10 | Implements Office.IRibbonExtensibility
11 | Private ribbon As Office.IRibbonUI
12 | Public Shared ribbonref As Ribbon
13 |
14 | Public Sub New()
15 | End Sub
16 |
17 | Public Function GetCustomUI(ByVal ribbonID As String) As String Implements Office.IRibbonExtensibility.GetCustomUI
18 | Return GetResourceText("ShapeExtract.Ribbon.xml")
19 | End Function
20 |
21 | Private Shared Function GetResourceText(ByVal resourceName As String) As String
22 | Dim asm As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
23 | Dim resourceNames() As String = asm.GetManifestResourceNames()
24 | For i As Integer = 0 To resourceNames.Length - 1
25 | If String.Compare(resourceName, resourceNames(i), StringComparison.OrdinalIgnoreCase) = 0 Then
26 | Using resourceReader As IO.StreamReader = New IO.StreamReader(asm.GetManifestResourceStream(resourceNames(i)))
27 | If resourceReader IsNot Nothing Then
28 | Return resourceReader.ReadToEnd()
29 | End If
30 | End Using
31 | End If
32 | Next
33 | Return Nothing
34 | End Function
35 |
36 | Public Sub Ribbon_Load(ByVal ribbonUI As Office.IRibbonUI)
37 | Me.ribbon = ribbonUI
38 | ribbonref = Me
39 | AssemblyInfo.SetAddRemoveProgramsIcon("VisioAddin.ico")
40 | End Sub
41 |
42 | Public Function GetLabelText(ByVal control As Office.IRibbonControl) As String
43 | Try
44 | Select Case control.Id.ToString
45 | Case Is = "tabShapeExtract"
46 | If Application.ProductVersion.Substring(0, 2) = "15" Then
47 | Return My.Application.Info.Title.ToUpper()
48 | Else
49 | Return My.Application.Info.Title
50 | End If
51 | Case Is = "txtCopyright"
52 | Return "© " & My.Application.Info.Copyright.ToString
53 | Case Is = "txtDescription", "btnDescription"
54 | Dim version As String = My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Build & "." & My.Application.Info.Version.Revision
55 | Return My.Application.Info.Title.ToString.Replace("&", "&&") & Space(1) & version
56 | Case Is = "txtReleaseDate"
57 | Return My.Settings.App_ReleaseDate.ToString("dd-MMM-yyyy hh:mm tt")
58 | Case Else
59 | Return String.Empty
60 | End Select
61 |
62 | Catch ex As Exception
63 | ErrorHandler.DisplayMessage(ex)
64 | Return String.Empty
65 |
66 | End Try
67 |
68 | End Function
69 |
70 | Public Sub OnAction(ByVal Control As Office.IRibbonControl)
71 | Try
72 | Select Case Control.Id
73 | Case = "btnExtractShapes"
74 | Ribbon_Buttons.ExportShapeValues()
75 | Case = "btnOpenFolder"
76 | Ribbon_Buttons.OpenFile(My.Settings.App_PathExportLocation)
77 | Case = "btnOpenFile"
78 | Ribbon_Buttons.OpenFile(My.Settings.App_FileExport)
79 | Case "btnSettings"
80 | Ribbon_Buttons.OpenSettings()
81 | Case "btnOpenReadMe"
82 | Ribbon_Buttons.OpenReadMe()
83 | Case "btnOpenNewIssue"
84 | Ribbon_Buttons.OpenNewIssue()
85 | End Select
86 |
87 | Catch ex As Exception
88 | ErrorHandler.DisplayMessage(ex)
89 |
90 | End Try
91 |
92 | End Sub
93 |
94 | Public Sub InvalidateRibbon()
95 | ribbon.Invalidate()
96 | End Sub
97 |
98 | End Class
99 |
100 | End Namespace
101 |
--------------------------------------------------------------------------------
/VB/ShapeExtract.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ShapeExtract", "ShapeExtract.vbproj", "{83F132A4-2544-4821-A838-9C9C48D5DD12}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {83F132A4-2544-4821-A838-9C9C48D5DD12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {83F132A4-2544-4821-A838-9C9C48D5DD12}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {83F132A4-2544-4821-A838-9C9C48D5DD12}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {83F132A4-2544-4821-A838-9C9C48D5DD12}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/VB/ShapeExtract.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 | {BAA0C2D2-18E2-41B9-852F-F413020CAA33};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
23 | Debug
24 | AnyCPU
25 | {83F132A4-2544-4821-A838-9C9C48D5DD12}
26 | Library
27 | ShapeExtract
28 | ShapeExtract
29 | v4.0
30 | VSTO40
31 |
32 |
33 | False
34 |
35 |
36 |
37 |
38 | 4.0
39 | true
40 | true
41 | C:\Temp\
42 |
43 | en
44 | 1.0.0.0
45 | true
46 | true
47 | 0
48 | days
49 | Visio Addin Shape Extract
50 | Anthony Duguid
51 |
52 | Visio Addin Shape Extract
53 |
54 | 3
55 |
56 |
57 |
58 | False
59 | Microsoft .NET Framework 4 %28x86 and x64%29
60 | true
61 |
62 |
63 | False
64 | .NET Framework 3.5 SP1 Client Profile
65 | false
66 |
67 |
68 | False
69 | .NET Framework 3.5 SP1
70 | true
71 |
72 |
73 | False
74 | Microsoft Office 2007 Primary Interop Assemblies
75 | true
76 |
77 |
78 | False
79 | Microsoft Visual Studio 2010 Tools for Office Runtime %28x86 and x64%29
80 | true
81 |
82 |
83 | False
84 | Windows Installer 3.1
85 | true
86 |
87 |
88 | False
89 | Windows Installer 4.5
90 | true
91 |
92 |
93 |
94 |
98 | Visio
99 |
100 |
101 | On
102 |
103 |
119 |
120 | $(DefineConstants)
121 | true
122 | true
123 | full
124 | true
125 | false
126 | bin\Debug\
127 | ShapeExtract.xml
128 | false
129 | false
130 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
131 |
132 |
148 |
149 |
150 |
151 | false
152 | true
153 | pdbonly
154 | true
155 | bin\Release\
156 | ShapeExtract.xml
157 | false
158 | false
159 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
160 |
161 |
164 |
165 |
166 | True
167 |
168 |
169 | True
170 |
171 |
172 | True
173 |
174 |
175 |
176 | True
177 |
178 |
179 | True
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 | True
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
216 |
217 |
218 |
219 |
220 |
221 | Settings.vb
222 |
223 |
224 | Form
225 |
226 |
227 |
228 |
229 | Code
230 |
231 |
232 |
233 | Designer
234 |
235 |
236 |
237 |
238 | ThisAddIn.vb
239 |
240 |
241 | ThisAddIn.Designer.xml
242 |
243 |
244 |
245 | Settings.vb
246 |
247 |
248 | VbMyResourcesResXFileCodeGenerator
249 | Resources.Designer.vb
250 | My.Resources
251 | Designer
252 |
253 |
254 | True
255 | True
256 | Resources.resx
257 |
258 |
259 | SettingsSingleFileGenerator
260 | Settings.Designer.vb
261 |
262 |
263 | True
264 | Settings.settings
265 | True
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 | 10.0
276 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
277 |
278 |
279 | On
280 |
281 |
282 | Binary
283 |
284 |
285 | Off
286 |
287 |
288 | true
289 |
290 |
291 | AnthonyDuguid.pfx
292 |
293 |
294 | 93965FE7740536E96E341C481EEBCAF9BF3BD295
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
--------------------------------------------------------------------------------
/VB/ThisAddIn.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict Off
12 | Option Explicit On
13 |
14 |
15 |
16 | '''
17 | _
19 | Partial Public NotInheritable Class ThisAddIn
20 | Inherits Microsoft.Office.Tools.AddInBase
21 |
22 | _
23 | Friend WithEvents Application As Microsoft.Office.Interop.Visio.Application
24 |
25 | '''
26 | _
28 | Public Sub New(ByVal factory As Global.Microsoft.Office.Tools.Factory, ByVal serviceProvider As Global.System.IServiceProvider)
29 | MyBase.New(factory, serviceProvider, "AddIn", "ThisAddIn")
30 | Globals.Factory = factory
31 | End Sub
32 |
33 | '''
34 | _
37 | Protected Overrides Sub Initialize()
38 | MyBase.Initialize
39 | Me.Application = Me.GetHostItem(Of Microsoft.Office.Interop.Visio.Application)(GetType(Microsoft.Office.Interop.Visio.Application), "Application")
40 | Globals.ThisAddIn = Me
41 | Global.System.Windows.Forms.Application.EnableVisualStyles
42 | Me.InitializeCachedData
43 | Me.InitializeControls
44 | Me.InitializeComponents
45 | Me.InitializeData
46 | End Sub
47 |
48 | '''
49 | _
52 | Protected Overrides Sub FinishInitialization()
53 | Me.OnStartup
54 | End Sub
55 |
56 | '''
57 | _
60 | Protected Overrides Sub InitializeDataBindings()
61 | Me.BeginInitialization
62 | Me.BindToData
63 | Me.EndInitialization
64 | End Sub
65 |
66 | '''
67 | _
70 | Private Sub InitializeCachedData()
71 | If (Me.DataHost Is Nothing) Then
72 | Return
73 | End If
74 | If Me.DataHost.IsCacheInitialized Then
75 | Me.DataHost.FillCachedData(Me)
76 | End If
77 | End Sub
78 |
79 | '''
80 | _
83 | Private Sub InitializeData()
84 | End Sub
85 |
86 | '''
87 | _
90 | Private Sub BindToData()
91 | End Sub
92 |
93 | '''
94 | _
96 | Private Sub StartCaching(ByVal MemberName As String)
97 | Me.DataHost.StartCaching(Me, MemberName)
98 | End Sub
99 |
100 | '''
101 | _
103 | Private Sub StopCaching(ByVal MemberName As String)
104 | Me.DataHost.StopCaching(Me, MemberName)
105 | End Sub
106 |
107 | '''
108 | _
110 | Private Function IsCached(ByVal MemberName As String) As Boolean
111 | Return Me.DataHost.IsCached(Me, MemberName)
112 | End Function
113 |
114 | '''
115 | _
118 | Private Sub BeginInitialization()
119 | Me.BeginInit
120 | End Sub
121 |
122 | '''
123 | _
126 | Private Sub EndInitialization()
127 | Me.EndInit
128 | End Sub
129 |
130 | '''
131 | _
134 | Private Sub InitializeControls()
135 | End Sub
136 |
137 | '''
138 | _
141 | Private Sub InitializeComponents()
142 | End Sub
143 |
144 | '''
145 | _
147 | Private Function NeedsFill(ByVal MemberName As String) As Boolean
148 | Return Me.DataHost.NeedsFill(Me, MemberName)
149 | End Function
150 | End Class
151 |
152 | '''
153 | _
155 | Partial Friend NotInheritable Class Globals
156 |
157 | '''
158 | Private Sub New()
159 | MyBase.New
160 | End Sub
161 |
162 | Private Shared _ThisAddIn As ThisAddIn
163 |
164 | Private Shared _factory As Global.Microsoft.Office.Tools.Factory
165 |
166 | Private Shared _ThisRibbonCollection As ThisRibbonCollection
167 |
168 | Friend Shared Property ThisAddIn() As ThisAddIn
169 | Get
170 | Return _ThisAddIn
171 | End Get
172 | Set
173 | If (_ThisAddIn Is Nothing) Then
174 | _ThisAddIn = value
175 | Else
176 | Throw New System.NotSupportedException()
177 | End If
178 | End Set
179 | End Property
180 |
181 | Friend Shared Property Factory() As Global.Microsoft.Office.Tools.Factory
182 | Get
183 | Return _factory
184 | End Get
185 | Set
186 | If (_factory Is Nothing) Then
187 | _factory = value
188 | Else
189 | Throw New System.NotSupportedException()
190 | End If
191 | End Set
192 | End Property
193 |
194 | Friend Shared ReadOnly Property Ribbons() As ThisRibbonCollection
195 | Get
196 | If (_ThisRibbonCollection Is Nothing) Then
197 | _ThisRibbonCollection = New ThisRibbonCollection(_factory.GetRibbonFactory)
198 | End If
199 | Return _ThisRibbonCollection
200 | End Get
201 | End Property
202 | End Class
203 |
204 | '''
205 | _
207 | Partial Friend NotInheritable Class ThisRibbonCollection
208 | Inherits Microsoft.Office.Tools.Ribbon.RibbonCollectionBase
209 |
210 | '''
211 | Friend Sub New(ByVal factory As Global.Microsoft.Office.Tools.Ribbon.RibbonFactory)
212 | MyBase.New(factory)
213 | End Sub
214 | End Class
215 |
--------------------------------------------------------------------------------
/VB/ThisAddIn.Designer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/VB/ThisAddIn.vb:
--------------------------------------------------------------------------------
1 | Imports ShapeExtract.Scripts
2 |
3 | Public Class ThisAddIn
4 |
5 | Protected Overrides Function CreateRibbonExtensibilityObject() As Microsoft.Office.Core.IRibbonExtensibility
6 | Return New Ribbon()
7 | End Function
8 |
9 | Private Sub ThisAddIn_Startup() Handles Me.Startup
10 |
11 | End Sub
12 |
13 | Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
14 |
15 | End Sub
16 |
17 | End Class
18 |
--------------------------------------------------------------------------------
/VB/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | C:\Temp
37 |
38 |
39 |
40 |
41 |
42 | https://github.com/Office-projects/VisioShapeExtract/blob/master/README.md
43 |
44 |
45 | https://github.com/Office-projects/VisioShapeExtract/issues/new
46 |
47 |
48 | 07/31/2017 13:05:00
49 |
50 |
51 |
52 |
53 |
54 |
55 | Anthony Duguid
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/VBA/ShapeExtract.Original.VBA.txt:
--------------------------------------------------------------------------------
1 | 'Option Explicit
2 |
3 | Public Function CustomProp() As Boolean
4 | Dim shpObj As Visio.Shape, celObj As Visio.Cell
5 | Dim i As Integer, j As Integer, ShpNo As Integer
6 | Dim LabelName As String, PromptName As String, ValName As String, Tabchr As String
7 |
8 | Open "C:\Data\CustomProp.txt" For Output Shared As #1
9 |
10 | Tabchr = Chr(9)
11 |
12 | For ShpNo = 1 To Visio.ActivePage.Shapes.Count
13 |
14 | Set shpObj = Visio.ActivePage.Shapes(ShpNo)
15 | nRows = shpObj.RowCount(Visio.visSectionProp)
16 | For i = 0 To nRows - 1
17 | Set celObj = shpObj.CellsSRC(Visio.visSectionProp, i, 0)
18 | ValName = celObj.ResultStr(Visio.visNone)
19 | Set celObj = shpObj.CellsSRC(Visio.visSectionProp, i, 1)
20 | PromptName = celObj.ResultStr(Visio.visNone)
21 | Set celObj = shpObj.CellsSRC(Visio.visSectionProp, i, 2)
22 | LabelName = celObj.ResultStr(Visio.visNone)
23 |
24 | Debug.Print shpObj.Name, LabelName, PromptName, ValName
25 | Print #1, shpObj.Name; Tabchr; LabelName; Tabchr; PromptName; Tabchr; ValName
26 |
27 | Next i
28 | Next ShpNo
29 | Close #1
30 |
31 | End Function
32 |
33 | Public Function DisplayDoc() As Boolean
34 | ' Display the name of the current document and the current page
35 | End Function
36 |
37 | Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
38 | Debug.Print ActiveDocument.Name
39 | Debug.Print ActivePage.Name
40 | Call CustomProp
41 | End Sub
42 |
--------------------------------------------------------------------------------
/VBA/ShapeExtract.vsdm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VBA/ShapeExtract.vsdm
--------------------------------------------------------------------------------
/VBA/header_footer.vsdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Visio-projects/Visio-Shape-Extract/14c3e97b88c8f5b19d21802972c4f60d0038837a/VBA/header_footer.vsdx
--------------------------------------------------------------------------------