Author Topic: Page setup  (Read 1369 times)

0 Members and 1 Guest are viewing this topic.

WOWENS

  • Newt
  • Posts: 59
Page setup
« on: March 10, 2014, 11:51:27 AM »
I'm having problems setting a page setup current, the problem I'm having is the back ground in paper space does not update to the new paper size see code below. see attached bmp file.

Code: [Select]
Public Sub PageSetup_SetCurrent(ByVal PageSetupName As String)
        Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim Db As Database = acDoc.Database

        Using acTrans As Transaction = Db.TransactionManager.StartTransaction()
            Dim acLayoutMgr As LayoutManager = LayoutManager.Current

            Dim acLayout As Layout = acTrans.GetObject(acLayoutMgr.GetLayoutId(acLayoutMgr.CurrentLayout), OpenMode.ForRead)
            Dim acPlSet As DBDictionary = acTrans.GetObject(Db.PlotSettingsDictionaryId, OpenMode.ForRead)

            If acPlSet.Contains(PageSetupName) = True Then
                Dim plSet As PlotSettings = acPlSet.GetAt(PageSetupName).GetObject(OpenMode.ForRead)

                acLayout.UpgradeOpen()

                acLayout.CopyFrom(plSet)

                acTrans.Commit()
            Else
                acTrans.Abort()
            End If
        End Using

        'acDoc.Editor.Regen()
        'DocumentManager.MdiActiveDocument.Editor.UpdateScreen()
        'DocumentManager.MdiActiveDocument.SendStringToExecute("_Zoom A ", True, False, False)
    End Sub





« Last Edit: March 10, 2014, 02:16:26 PM by WOWENS »

WOWENS

  • Newt
  • Posts: 59
Re: Page setup
« Reply #1 on: March 10, 2014, 03:07:17 PM »
added this to the code for the fix
Code: [Select]
Dim psv As PlotSettingsValidator = PlotSettingsValidator.Current
                psv.SetZoomToPaperOnUpdate(acLayout, True)