Printer Monitor Page Count with PrinterQueueWatch.dll

This blog is about solving the issue of page count problem of word file and excel file. In PrinterQueueWatch.dll, we always face page counting problem in word and excel files. So, I found the solution for this. You have to add one registry value ForceSetCopyCount and set value to 1 for both word and excel.

Here is the sample code for MS-Word

Microsoft.Win32.RegistryKey subKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0\Word\Options");
            if (checkIfKeyExists(subKey))
            {
                RegistryKey keyx = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0\Word\Options", true);
                {
                    keyx.SetValue("ForceSetCopyCount", 1, RegistryValueKind.DWord);
                    keyx.Flush();
                }
            }

Here is the sample code for MS-Excel

Microsoft.Win32.RegistryKey subKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0\Excel\Options");
            if (checkIfKeyExists(subKey))
            {
                RegistryKey keyx = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0\Excel\Options", true);
                {
                    keyx.SetValue("ForceSetCopyCount", 1, RegistryValueKind.DWord);
                    keyx.Flush();
                }
            }

Hope this help someone

Happy Coding yessmileyyes

Author Profile

pallav

Pallav Kumar

@pallav
Software Engineer
Delhi, India

Leave a Comment

message*