PageHeight returning inches for some reason

Started by morelup, January 16, 2020, 01:26:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

morelup

So I have an addin that is doing some logic based off of PageHeight.  This works fine on my laptop that i've developed on, and everyone i've deployed this addin to has not had this issue.  On my newly built PC though when I do the below logic:

_pageHeight = Convert.ToDouble(_page.PageSheet.Cells["PageHeight"].Formula.Replace(" mm.", ""));

I'm getting an error because .Formula is returning the value in inches.  The strange thing is, i'm opening up identical files on both my working laptop and non-working desktop, and when inspecting the page on the desktop it shows as "PageHeight = 210 mm"

Any ideas what I am doing wrong?

morelup

Ok, strangest thing, now this desktop works fine, but I have to change the tab I'm looking at when the file opens up (note i can go back to that tab after changing) and it works fine.

ImAPictureFormat

Most of my experience is with VBA, but I believe you could do something like this to always get the result in millimeters across your devices:


_pageHeight = Convert.ToDouble(_page.PageSheet.Cells["PageHeight"].Result(visMillimeters).Replace(" mm.", ""));


The constant visMillimeters I'm getting from the documentation here: https://docs.microsoft.com/en-us/office/vba/api/visio.visunitcodes

Hope this helps.