Javascript Indesign将段落导出为基于文本的csv

Javascript Indesign将段落导出为基于文本的csv,javascript,csv,adobe-indesign,Javascript,Csv,Adobe Indesign,我们正在尝试编写一个简单的脚本,将所有故事导出到Indesign文件中 我们只有两种风格的标题,即每篇文章的标题 和文本,这是本文的主体 我们需要导出到csv文件(文本),这样我们就可以在一系列应用程序中导入,如下所示: 标题、文本(段落系列) “xxxxx”、“xxxxxxxxx x x xxxxx xxxxx xxxxx” “xxxxx”、“xxxxxxxxx x x xxxxx xxxxx xxxxx” “xxxxx”、“xxxxxxxxx x x x xxxxx xxxxx xxxxx”

我们正在尝试编写一个简单的脚本,将所有故事导出到Indesign文件中 我们只有两种风格的标题,即每篇文章的标题 和文本,这是本文的主体 我们需要导出到csv文件(文本),这样我们就可以在一系列应用程序中导入,如下所示:

标题、文本(段落系列)
“xxxxx”、“xxxxxxxxx x x xxxxx xxxxx xxxxx”
“xxxxx”、“xxxxxxxxx x x xxxxx xxxxx xxxxx”
“xxxxx”、“xxxxxxxxx x x x xxxxx xxxxx xxxxx”

但我们发现了一个问题,当我们试图写入文件时,“段落内容”的字符串变量不会写入文件,我们可以在警报对话框中显示它们,但不能将它们写入文本文件

问题是第46行,我们不知道是否必须去掉一些字符或将内容转换为唯一的文本变量

这是密码

//Exportascsv.js  
      var myStory, myParagraph, myParagraphTemp, myString, myTag, myStartTag;   var myEndTag, myTextStyleRange, myTable;  
      if(app.documents.length !=0){     if(app.documents.item(0).stories.length != 0){   //Open a new text file.  
    var myTextFile = File.saveDialog("Save CSV As", undefined);   //If the user clicked the Cancel button, the result is null.  
    if(myTextFile != null){   //Open the file with write access.  
      myTextFile.open("w");  
      var myCounterArt = 0;   //walk through the stories.  
      for(var myCounter = 0; myCounter < app.documents.item(0).stories.length; myCounter++){  
        myStory = app.documents.item(0).stories.item(myCounter);   // we have stories inside stories (articles in articles sometimes)  
        var myParagraphCounter = 0;  
        myParagraphTemp = "";  
        myString = "";  
        do{  
          myParagraph = myStory.paragraphs.item(myParagraphCounter);  
          myParagraphTemp = "";  
          switch(myParagraph.appliedParagraphStyle.name){   //Headline paragraph style  
              case "Headline":  
                myString = '"'+myParagraph.contents+'","';  
                myParagraphCounter++;  
                break;  
              case "Texto":   //Text paragraph style  
                myString = myString+myParagraph.contents;  
                myParagraphCounter++;  
                break;  
              default:  
                myParagraphCounter++;  
                break;  
          }  
        } while (myParagraphCounter < myStory.paragraphs.length)  
        myString = myString+'"';  
        myTextFile.writeln(myString);  
      }  
      myTextFile.write("\r");  
      myTextFile.close();  
    }     }   }  
//Exportascsv.js
变量myStory、myParagraph、myParagraphTemp、myString、myTag、myStartTag;变量myEndTag、myTextStyleRange、myTable;
if(app.documents.length!=0){if(app.documents.item(0).stories.length!=0){//打开一个新的文本文件。
var myTextFile=File.saveDialog(“将CSV另存为”,未定义);//如果用户单击“取消”按钮,则结果为空。
如果(myTextFile!=null){//使用写访问权限打开文件。
myTextFile.open(“w”);
var myCounterArt=0;//浏览故事。
对于(var myCounter=0;myCounter
这是文件的编码欢迎使用堆栈溢出。我在你的帖子中编辑了一些英文版。我在块的开头用>标记了数据,每行后面用两个空格。问题解决了吗?