Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to import rtf file?

Contributor ,
Oct 30, 2015 Oct 30, 2015

Hi.

I want to import file in a text frame.

Txt file is possible. But rtf file bring up the with the code.

            var FilePath = "c:/temp/txt/" + FileName;

            var txtFile = new File(FilePath);

            var txtFileContents;

   

            if(txtFile.exists)

            {

                var txtFileOpenFlag = txtFile.open("r");

 

                if(txtFileOpenFlag == true)

                {

                    txtFileContents = txtFile.read();

                }

            }

            app.selection[0].contents = txtFileContents; 

How to import rtf file?

Thanks.

TOPICS
Scripting
835
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Oct 30, 2015 Oct 30, 2015

Hi,

While import a file there is no need to open it and read its contents (by script)

Use:

app.selection[0].place(txtFile) method

Jarek

Translate
Mentor ,
Oct 30, 2015 Oct 30, 2015

Hi,

While import a file there is no need to open it and read its contents (by script)

Use:

app.selection[0].place(txtFile) method

Jarek

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 01, 2015 Nov 01, 2015
LATEST

Thank you for always help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines