R
Robert Carsto
Trying to set page width in C# generates an error. I am using Publisher
2003.
here is my sample code segment and the error received. What am I doing
wrong?
Publisher.Application App = new Publisher.Application();
Template = App.Open(@"test.pub", true, true,
Publisher.PbSaveOptions.pbDoNotSaveChanges);
Template.PageSetup.PageWidth = 11 * 8.5;
System.UnauthorizedAccessException: Access is denied.
at Publisher.PageSetup.set_PageWidth(Object RetValue)
at PublisherSample.Class1.Main(String[] args) in
c:\publisher\class1.cs:line 62
The VB example in MSDS is as follows. What am I doing wrong?
Sub SetPageSetupOptions()
With ActiveDocument.PageSetup
.PageHeight = 11 * 72
.PageWidth = 8.5 * 72
End With
End Sub
I am able to set other properties in my document. Its only PageWidth that
fails.
Template.PageSetup.MultiplePagesPerSheet = false;
Template.PageSetup.LeftMargin = (float)Template.PageSetup.LeftMargin ;
Template.PageSetup.TopMargin = (float)Template.PageSetup.TopMargin;
its only PageWidth and PageHeight that fails.
2003.
here is my sample code segment and the error received. What am I doing
wrong?
Publisher.Application App = new Publisher.Application();
Template = App.Open(@"test.pub", true, true,
Publisher.PbSaveOptions.pbDoNotSaveChanges);
Template.PageSetup.PageWidth = 11 * 8.5;
System.UnauthorizedAccessException: Access is denied.
at Publisher.PageSetup.set_PageWidth(Object RetValue)
at PublisherSample.Class1.Main(String[] args) in
c:\publisher\class1.cs:line 62
The VB example in MSDS is as follows. What am I doing wrong?
Sub SetPageSetupOptions()
With ActiveDocument.PageSetup
.PageHeight = 11 * 72
.PageWidth = 8.5 * 72
End With
End Sub
I am able to set other properties in my document. Its only PageWidth that
fails.
Template.PageSetup.MultiplePagesPerSheet = false;
Template.PageSetup.LeftMargin = (float)Template.PageSetup.LeftMargin ;
Template.PageSetup.TopMargin = (float)Template.PageSetup.TopMargin;
its only PageWidth and PageHeight that fails.