public void CloseDocument(TargetDocument targetdoc, bool force)
        {
            targetdoc = targetdoc.Resolve(this._client);


            var doc = targetdoc.Document;
            var app = doc.Application;

            if (doc.Type != IVisio.VisDocumentTypes.visTypeDrawing)
            {
                this._client.Output.WriteVerbose("Not a Drawing Window", doc.Name);
                throw new System.ArgumentException("Not a Drawing Window");
            }

            this._client.Output.WriteVerbose("Closing Document Name=\"{0}\"", doc.Name);
            this._client.Output.WriteVerbose("Closing Document FullName=\"{0}\"", doc.FullName);

            if (force)
            {
                using (var alert = new VisioAutomation.Application.AlertResponseScope(app, VisioAutomation.Application.AlertResponseCode.No))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
        public List <IVisio.Page> FindPagesByName(TargetDocument targetdoc, string name, Models.PageType pagetype)
        {
            targetdoc = targetdoc.Resolve(this._client);

            if (VisioScripting.Helpers.WildcardHelper.NullOrStar(name))
            {
                // return all pages
                var all_pages = targetdoc.Document.Pages.ToList();
                all_pages = _filter_pages_by_type(all_pages, pagetype);
                return(all_pages);
            }
            else
            {
                // return the named page
                var all_pages   = targetdoc.Document.Pages.ToEnumerable();
                var named_pages = VisioScripting.Helpers.WildcardHelper.FilterObjectsByNames(all_pages, new[] { name }, p => p.Name, true, VisioScripting.Helpers.WildcardHelper.FilterAction.Include).ToList();
                named_pages = _filter_pages_by_type(named_pages, pagetype);

                return(named_pages);
            }
        }
 public void SaveDocumentAs(TargetDocument targetdoc, string filename)
 {
     targetdoc = targetdoc.Resolve(this._client);
     targetdoc.Document.SaveAs(filename);
 }
 public void SaveDocument(TargetDocument targetdoc)
 {
     targetdoc = targetdoc.Resolve(this._client);
     targetdoc.Document.Save();
 }