locked
Document class.PrintOut exception : String is longer than 255 characters RRS feed

  • Question

  • Dear team

    when i print from a printout method, it gives me below excpetion...

    String is longer than 255 characters

    Error   at Microsoft.Office.Interop.Word.DocumentClass.PrintOut(Object& Background, Object& Append, Object& Range, Object& OutputFileName, Object& From, Object& To, Object& Item, Object& Copies, Object& Pages, Object& PageType, Object& PrintToFile, Object& Collate, Object& ActivePrinterMacGX, Object& ManualDuplexPrint, Object& PrintZoomColumn, Object& PrintZoomRow, Object& PrintZoomPaperWidth, Object& PrintZoomPaperHeight)
       at PrintDocuments.CommonClasses.WordService.LoadDocument(String fileName)

    Thanks

    Prasad

    Monday, July 13, 2020 10:54 AM

All replies

  • Prasad,

    Do you get the same issue when operation is done manually?

    This issue occurs because of a 259-character limitation on creating and saving files in the Office products. Also, you receive an error message when you save or open a file if the path of the file meets the following condition for the appropriate program.
    • Word: The total length of the path and the file name, including file name extension, exceeds 259 characters.
    • PowerPoint: The total length of the path and the file name, including file name extension, exceeds 259 characters.
    • Access: The total length of the path and the file name, including file name extension exceeds 259 characters.
    • Excel: The total length of the path and the file name, including file name extension, exceeds 218 characters.

    Read more about that in the You receive error messages when you try to open an Office document article. 

    Also you may find the How To Fix ‘Filename Is Too Long’ Issue In Windows page helpful.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, July 13, 2020 3:11 PM
  • Dear Eugune

             Thanks for the reply. we are not getting error when we manually print the file from same location ? it orrure when we print it using word object, what could be the possible causes ?

    Thanks

    Prasad

    Monday, July 27, 2020 9:09 AM