Forum Discussion

Oferv's avatar
Oferv
Super Contributor
14 years ago

auto generate file types

Hi,

does TC have the ability to auto generate files type(txt,doc,docx,xls,xlsx,etc).what we are actually looking for is to create many files as we can and to edit it with different text/special characters/pictures/etc for each document.

is that possible?

thanks
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    You can use the MS Word and MS Excel COM architecture within the applications for creating documents and spreadsheets.  You can also use the aqFile methods for creating text files and CSV files of various formats.



    For the Excel operations, you can read a bit more at http://smartbear.com/support/viewarticle/20878/



    For anything involving working with MS Word and MS Excel, the architecture and methods available are documented at the MSDN Library.  Essentially, any object available in windows can be instantiated and operated using Sys.OleObject so, for MS Word, you can instantiate Sys.OleObject("Word.Application") and for Excel you can create Sys.OleObject("Excel.Application") and then operate within those objects/



    For the aqFile methods and features, you can read documentation at http://smartbear.com/support/viewarticle/12057/.
  • Oferv's avatar
    Oferv
    Super Contributor
    Great, i created files and now i want to type different random text/numbers/characters/special characters to those files is that possible?the order of the typing doesn't matter to me i just want to blow the documents with any text but i need the document to be different
  • Oferv's avatar
    Oferv
    Super Contributor
    different fonts,different size also should be taken as an option
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Working with the Word and Excel docs, you'll have to investigate the methods and options available via the MSDN Library that I posted earlier to find the proper methods of writing information to those files.



    As for the text and csv files, you can work with those files using the aqFile.WriteToTextFile method.  You can also, use aqFile.OpenTextFile to open a file and return a handle to that file where you can, then, use the WriteLine method to write lines to the text file.