Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Netsuite 如何在使用suitelet创建的excel文件中传递动态值_Netsuite_Suitescript - Fatal编程技术网

Netsuite 如何在使用suitelet创建的excel文件中传递动态值

Netsuite 如何在使用suitelet创建的excel文件中传递动态值,netsuite,suitescript,Netsuite,Suitescript,我在suitelet中创建了一个excel文件。我想在excel文件中传递动态值,因此如何才能做到这一点。例如: 我想通过: var transaction_id = searchresult.getValue("internalid",'transaction'); 在excel文件中 我尝试了下面的方法,但它抛出了损坏的文件错误*注意:在将动态数据传递到文件时,会生成包含静态数据的文件 var xmlStr = '<?xml version="1.0"?><?ms

我在suitelet中创建了一个excel文件。我想在excel文件中传递动态值,因此如何才能做到这一点。例如: 我想通过:

  var transaction_id = searchresult.getValue("internalid",'transaction');
在excel文件中

我尝试了下面的方法,但它抛出了损坏的文件错误*注意:在将动态数据传递到文件时,会生成包含静态数据的文件

  var xmlStr = '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>';
    xmlStr += '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" ';
    xmlStr += 'xmlns:o="urn:schemas-microsoft-com:office:office" ';
    xmlStr += 'xmlns:x="urn:schemas-microsoft-com:office:excel" ';
    xmlStr += 'xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" ';
    xmlStr += 'xmlns:html="http://www.w3.org/TR/REC-html40">';

    xmlStr += '<Worksheet ss:Name='sheet_name'>';

    //Below mention is the place(transaction_id) where I want to pass the dynamic value 
    xmlStr += '<Table>' +
    '<Row>' +
    '<Cell><Data ss:Type="String">transaction_id</Data></Cell>' +
    '</Row>';

xmlStr += '</Table></Worksheet></Workbook>';

var xlsFile = nlapiCreateFile('sheet_name.xls', 'EXCEL', nlapiEncrypt(xmlStr, 'base64'));

xlsFile.setFolder(6157);

var fileID = nlapiSubmitFile(xlsFile);
var xmlStr='';
xmlStr+='';
xmlStr+='';
//下面提到的是我希望传递动态值的位置(事务\u id)
xmlStr+=“”+
'' +
“事务处理id”+
'';
xmlStr+='';
var xlsFile=nlapiCreateFile('sheet_name.xls','EXCEL',nlapiEncrypt(xmlStr,'base64');
xlsFile.setFolder(6157);
var fileID=nlapsubmitfile(xlsFile);

谢谢

假设您已经将
transaction\u id
作为一个变量,并且您已经适当地填充了它,那么您只需要将两个标记字符串与您的变量连接起来:

“”+事务处理\u id+“”+

假设您已经将
事务\u id
作为变量,并且已经正确填充了它,那么您只需要将两个标记字符串与变量连接起来:

“”+事务处理\u id+“”+