1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Quite urgent- create thousands of documents in one go?

Discussion in 'The Lounge - Off Topic' started by Juelz, Aug 3, 2016.

  1. Juelz

    Juelz Gigabyte Poster

    Top Poster
    of the Month

    1,176
    185
    176
    is there a cmd/powershell command I can use or anything to create multiple blank documents? Like thousands in one go?
     
    Certifications: MTA Windows Fundamentals, ITIL Foundation, Mac Integration Basics 10.12
  2. dmarsh

    dmarsh Terabyte Poster

    3,782
    302
    184
    Yah loads ways to do it if you're a programmer.

    Can create documents of any type you want, with any content you want.
     
    Certifications: CITP, BSc, HND, SCJP, SCJD, SCWCD, SCBCD, SCEA, N+, Sec+, Proj+, Server+, Linux+, MCTS, MCPD, MCSA, MCITP, CCDH
  3. Juelz

    Juelz Gigabyte Poster

    Top Poster
    of the Month

    1,176
    185
    176
    go on @dmarsh do tell.. I need the quickest way!
     
    Certifications: MTA Windows Fundamentals, ITIL Foundation, Mac Integration Basics 10.12
  4. dmarsh

    dmarsh Terabyte Poster

    3,782
    302
    184
    Modern word documents are XML in a Zip archive, so you can use regular file IO and XML libs in the language of your choice or you can use a specialist Word API like OpenXML.

    .NET has the WordProcessingDocument class for instance.
    https://msdn.microsoft.com/en-us/li...ging.wordprocessingdocument(v=office.14).aspx
    http://stackoverflow.com/questions/21893408/create-new-empty-word-document

    Word also is written in COM, so you can call the COM API's or use COM interop to create word documents.

    There are also many third party libraries designed to make it easy to work with office file formats.

    Even if it was the old binary formats, you can do binary file IO and write a word header to the file.

    At the end of the day a file is a file, its a series of bytes on the file system.

    Here is an example creating lots Word documents with powershell, its basically a file copy example, it cheats by just copying a word file and renaming it each time.
    https://blogs.technet.microsoft.com...powershell-to-create-documents-from-template/

    Word itself is also customizable using VS Extensions.

    Why on earth do you require thousands of empty documents ? Seems a little pointless.

    Whats more common is say invoice generation from say a database or mail merge etc.
     
    Last edited: Aug 3, 2016
    Certifications: CITP, BSc, HND, SCJP, SCJD, SCWCD, SCBCD, SCEA, N+, Sec+, Proj+, Server+, Linux+, MCTS, MCPD, MCSA, MCITP, CCDH
    Juelz likes this.
  5. dmarsh

    dmarsh Terabyte Poster

    3,782
    302
    184
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se wp14">
    <w:body>
    <w:p w:rsidR="008A4218" w:rsidRDefault="006432A8">
    <w:r><w:t>This is a test</w:t></w:r>
    <w:bookmarkStart w:id="0" w:name="_GoBack"/><w:bookmarkEnd w:id="0"/></w:p><w:sectPr w:rsidR="008A4218"><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="708" w:footer="708" w:gutter="0"/><w:cols w:space="708"/><w:docGrid w:linePitch="360"/></w:sectPr>
    </w:body></w:document>
    This is what a basic Word Open XML document looks like, only there are a lot of other metadata files in a zip long with it.
     
    Certifications: CITP, BSc, HND, SCJP, SCJD, SCWCD, SCBCD, SCEA, N+, Sec+, Proj+, Server+, Linux+, MCTS, MCPD, MCSA, MCITP, CCDH
    Juelz likes this.
  6. Juelz

    Juelz Gigabyte Poster

    Top Poster
    of the Month

    1,176
    185
    176
    Thanks mate, yeah I was trying to recreate an issue on a support case I had, all resolved now, glad to see the back of it!
     
    Certifications: MTA Windows Fundamentals, ITIL Foundation, Mac Integration Basics 10.12
  7. dmarsh

    dmarsh Terabyte Poster

    3,782
    302
    184
    Care to share the issue and resolution ?
     
    Certifications: CITP, BSc, HND, SCJP, SCJD, SCWCD, SCBCD, SCEA, N+, Sec+, Proj+, Server+, Linux+, MCTS, MCPD, MCSA, MCITP, CCDH

Share This Page

Loading...