Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to replace .docx file?


From   Stas Kolenikov <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: How to replace .docx file?
Date   Fri, 6 Dec 2013 10:25:53 -0600

-real scalar replace- indicates that this must be a number, rather
than a string, as you specified. The help file says that anything
non-zero would be considered, in Stata's tradition of logical
expression evaluation, to be true. So you instead need to write

_docx_save(dh, "example.docx", 1)


-- Stas Kolenikov, PhD, PStat (ASA, SSC)
-- Senior Survey Statistician, Abt SRBI
-- Opinions stated in this email are mine only, and do not reflect the
position of my employer
-- http://stas.kolenikov.name



On Fri, Dec 6, 2013 at 9:51 AM, Friedrich Huebler <[email protected]> wrote:
> I am experimenting with the creation of .docx files and don't know how
> to specify the -replace- option. According to -help mf__docx-,
> documents are saved with this command:
>
> _docx_save(dh, string scalar filename [, real scalar replace])
>
> Take this example, adapted from -help mf__docx-.
>
> * Create a document
> mata:
> dh = _docx_new()
> end
>
> * Add some text
> mata:
> _docx_paragraph_new(dh, "Some text")
> end
>
> * Save file
> mata:
> res = _docx_save(dh, "example.docx")
> end
>
> * Replace file
> mata:
> res = _docx_save(dh, "example.docx", replace)
> end
>
> The last command results in an error message.
>
> . * Replace file
> . mata:
> ------------------------------------------------- mata (type end to
> exit) --------------------------------------
> : res = _docx_save(dh, "example.docx", replace)
>                  <istmt>:  3499  replace not found
> (0 lines skipped)
> ----------------------------------------------------------------------------------------------------------------
> r(3499);
>
> I tried different variations of the -replace- option with the same
> result. What am I doing wrong?
>
> Friedrich
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index