8 Replies Latest reply: May 15, 2014 10:06 AM by scrappy1855 _ RSS

    Monarch v10 report printout

    scrappy1855 _

      I have a huge access VBA routine that Prints a report into individual pages based off of the page numbers in an access database. The whole process works flawless except my font size keeps getting changed back to size 12. So the next time it prints the font is way to large. I can't seem to find anywhere in the programming manual to set the font size. Does anyone have any advise?

       

      My code is below.

       

      Dim MonarchObj As Object

      Dim openfile, openmod, report, openreport As Boolean

       

      Set MonarchObj = GetObject("", "Monarch32")

          If MonarchObj Is Nothing Then

      Set MonarchObj = CreateObject("Monarch32")

          End If

              report = "v:\Daily\automationdirectory\working\report.prn"

                  With MonarchObj

                  openreport = MonarchObj.SetReportFile(report, True)

                      If openreport = True Then

                      .printreport True

                      End If

                      .CloseAllDocuments

                      .Exit

                  End With

       

      /CODE

       

      Theres alot more code but i only supplied what i felt was needed.

       

      thanks ahead of time for the help.

       

      forgot to mention this is Monarch Professional V 10.5.

        • Monarch v10 report printout
          Data Kruncher

          Hello and welcome to the Monarch forum Scrappy.

           

          You're correct; you don't get much (any?) font control via the COM interface.

           

          I'd think that you'd get better control by exporting a PDF file from the report window and then send your page numbers to a command line PDF utility such as [URL="http://www.accesspdf.com/pdftk/"]pdftk[/URL] to control which pages get printed.

           

          I've had good success with pdftk. I had an Excel dashboard report which was programmed to create a series of one page PDF files, one for each main reporting element. Once the collection of PDFs was completed, pdftk would assemble them all into a single PDF document. Of course, that's all completely unrelated to your task at hand, so once again I digress...

           

          Back to your task. As a test, I set a 180 column text file to 6 point Courier New in the report window and the resultant PDF export was perfect, but YMMV.

           

          Good luck,

          Kruncher

            • Monarch v10 report printout
              scrappy1855 _

              something like that might work but but it would take alot longer. My process first of all models the page number from one report and runs them through a query to get the pages that need to be printed. From that my access vba macro only opens and prints the pages from monarch for the pages that need to be printed. I think the problem that i'm having is that I have 200 + projects and i have a feeling among those one of them has the report font size changed to font 12 so when it hits that project and its run then it changes the registry entry from 8 point font to 12. So I wonder If i couldn't just have my vba macro check the registry on that entry to see if the font size is 8 or another variable. Then change it. Maybe that will be the way to go since apparently theres no COM control . Any other advise woudl be greatly appreciated.

                • Monarch v10 report printout
                  scrappy1855 _

                  Does anyone simply know what causes the registry entry to Trigger the font size? If one of my projects runs and the registry entry is 8 but the project report font size is 12 then it sets the registry to size 12 , but it doesn't seem to be changing it back to 8 when another project runs. Maybe theres a way to set a default settings for all of my projects. Thank you.

                    • Monarch v10 report printout
                      Joe Berry

                      I think that the font face and size is maintained in the model for the report window, the table window and the summary window.  A search and replace program or editor might be able to change the values for you quickly.

                       

                      I sometimes directly edit Model and Project files using an Editor that can display XML files properly.  In this case, the Monarch Utility may lend itself to this task.

                       

                      Joe

                      • Monarch v10 report printout
                        Olly Bond

                        Hello Scrappy,

                         

                        I'd suspect it may be more than one of your models or projects that's setting the font size in the report window, and that Monarch seems to be considerately remembering these for you for use in future sessions.

                         

                        Fortunately the models and projects are all plain text - it should be easy to identify those specifying a font size in the report window. Making a backup before you make any changes, perhaps trying to find or change:

                         

                        [/CODE]

                         

                        in project files, and in model files:

                         

                        [/CODE]

                         

                        HTH,

                         

                        Olly

                          • Monarch v10 report printout
                            scrappy1855 _

                            Olly,

                             

                            Your are my hero,

                             

                            That did it. I went back several weeks back and changed a bunch of them by opening the project file and model and setting the models on the report page to font 8 but that took forever. This worked great. already got them all changed. also putting in a reg punch before my access db does its thing so that if for some reason the default gets changed the reg punch will have it set back to 8 anyway.

                             

                            I appreciate your help, Honestl didn't know that you could edit a model or prj as a text file. that is very good to know. sure beats having to put the report back in the automation directory so that i can get the project open. Thanks.

                             

                             

                             

                            Hello Scrappy,

                             

                            I'd suspect it may be more than one of your models or projects that's setting the font size in the report window, and that Monarch seems to be considerately remembering these for you for use in future sessions.

                             

                            Fortunately the models and projects are all plain text - it should be easy to identify those specifying a font size in the report window. Making a backup before you make any changes, perhaps trying to find or change:

                             

                            [/CODE]

                             

                            in project files, and in model files:

                             

                            [/CODE]

                             

                            HTH,

                             

                            Olly[/QUOTE]

                              • Monarch v10 report printout
                                Olly Bond

                                Hello Scrappy,

                                 

                                You're welcome, and thanks for the thanks! I've been playing around a fair bit with what you can do with the xmod and xprj files - please be careful. I tried to inject filters into a model and managed to break it - the XML can be cantankerous and Monarch makes no effort to prettify it using regular white space. DataPump does, with projects only, not with their corresponding models. But to do this you need to edit the project in DataPump's XPRJ Project Editor.

                                 

                                A word of advice to anyone out there trying this - 1) make a backup, 2) test the backup, 3) double check the backup, 4) find a decent text editor that will let you see tabs, soft returns and other odd characters that may have crept in, 5) have fun experimenting and finally, 6) please post back here and let us know what useful tricks you discover!

                                 

                                Best wishes,

                                 

                                Olly

                                  • Monarch v10 report printout
                                    scrappy1855 _

                                    All I changed in the text editor was a 12 to a 8 and the models seemed to still work correctly, the txt files don't have a preceeding 0 for fonts lower than 10 so that shoudl be ok but thanks for the heads up. But just for an added measure I am adding this snippet to my code for added error handling

                                     

                                    Dim Shell

                                    Set Shell = WScript.CreateObject("Wscript.Shell")

                                     

                                    Shell.RegWrite "HKEY_CURRENT_USER\Software\Datawatch\Monarch Pro\InputView\Fontsize", 00000008, "REG_DWORD"

                                     

                                    Shell.RegWrite "HKEY_CURRENT_USER\Software\Datawatch\Monarch Pro\InputView\Font", "Courier New", "REG_SZ"

                                     

                                    Set Shell = Nothing

                                     

                                    Hello Scrappy,

                                     

                                    You're welcome, and thanks for the thanks! I've been playing around a fair bit with what you can do with the xmod and xprj files - please be careful. I tried to inject filters into a model and managed to break it - the XML can be cantankerous and Monarch makes no effort to prettify it using regular white space. DataPump does, with projects only, not with their corresponding models. But to do this you need to edit the project in DataPump's XPRJ Project Editor.

                                     

                                    A word of advice to anyone out there trying this - 1) make a backup, 2) test the backup, 3) double check the backup, 4) find a decent text editor that will let you see tabs, soft returns and other odd characters that may have crept in, 5) have fun experimenting and finally, 6) please post back here and let us know what useful tricks you discover!

                                     

                                    Best wishes,

                                     

                                    Olly[/QUOTE]