豪~豪
发表于 2024-5-29 14:52:58
正一味 发表于 2024-5-29 10:24
测试的是用弹窗输出的,本来的需求是要把这个单元格的内容打印出来
但是打印导出的html页面好像是因为r ...
你没有使用活字格方法写入:Forguncy.Page.getCell(name).setValue(value);所以你单元格指定是获取不到的。
你可以在JS最后加入下面两个命令
var code = document.querySelector('').innerHTML;
Forguncy.Page.getCellByLocation('code').setValue(code);
然后正文内容=code就行了
正一味
发表于 2024-5-29 14:56:49
Lay.Li 发表于 2024-5-29 12:30
感谢各位大佬的支持~
正如楼上大佬所述,这儿边没有看到alert()的命令哈。您是这个alert()弹出的result么 ...
我是设置的命令弹出,alert的是错误码提醒的
正一味
发表于 2024-5-29 16:04:08
豪~豪 发表于 2024-5-29 14:52
你没有使用活字格方法写入:Forguncy.Page.getCell(name).setValue(value);所以你单元格指定是获取不到的 ...
大佬,我按你的方法改了一下,成功获得到了result的值,但是我这里想显示的是它html的效果,还有什么办法吗想要的效果是这样的:
豪~豪
发表于 2024-5-29 16:05:02
本帖最后由 豪~豪 于 2024-5-29 16:09 编辑
正一味 发表于 2024-5-29 16:04
大佬,我按你的方法改了一下,成功获得到了result的值,但是我这里想显示的是它html的效果,还有什么办法吗想 ...
$('').html(printTemplale);
Forguncy.Page.getCellByLocation('result').setValue(printTemplale);
你应该使用这个解决方案
加在这里
正一味
发表于 2024-5-29 16:19:46
豪~豪 发表于 2024-5-29 16:05
你应该使用这个解决方案
加在这里
大佬,我是想要把PrintTemplate中的html代码以html的样式放到result这个单元格里的,是这个意思吗.这个code变量在这的作用我不太理解
豪~豪
发表于 2024-5-29 16:26:40
正一味 发表于 2024-5-29 16:19
大佬,我是想要把PrintTemplate中的html代码以html的样式放到result这个单元格里的,是这个意思吗.这个code ...
$('').html(printTemplale);//改变单元格
Forguncy.Page.getCellByLocation('result').setValue(printTemplale);//创建活字格变量
豪~豪
发表于 2024-5-29 16:30:30
正一味 发表于 2024-5-29 16:19
大佬,我是想要把PrintTemplate中的html代码以html的样式放到result这个单元格里的,是这个意思吗.这个code ...
你这个不要贴图片,你代码贴出来,早给你完整代码了
正一味
发表于 2024-5-29 16:38:24
豪~豪 发表于 2024-5-29 16:30
你这个不要贴图片,你代码贴出来,早给你完整代码了
var p = Forguncy.Page;
var size = getCellValue("TemplateSize");
var ResultCode = getCellValue("ResultCode");
var PrintTemplate = getCellValue("PrintTemplate");
if (ResultCode == 100)
{
/*Forguncy.Page.getCell("PrintTemplate").setValue(PrintTemplate);
if(PrintTemplate != null){
var code = document.querySelector('').innerHTML;
Forguncy.Page.getCell('result').setValue(code);
}*/
Forguncy.Page.getCell("PrintTemplate").setValue(PrintTemplate);
if(PrintTemplate != null){
$("").html(PrintTemplate);
}
alert("下单成功,请打印标签!");
};
if (ResultCode == 105)
{
alert(Reason);
};
if (ResultCode == 106)
{
/*Forguncy.Page.getCell("PrintTemplate").setValue(PrintTemplate);
if(PrintTemplate != null){
var code = document.querySelector('').innerHTML;
Forguncy.Page.getCell('result').setValue(code);
result = code;
}*/
Forguncy.Page.getCell("PrintTemplate").setValue(PrintTemplate);
if(PrintTemplate != null){
$("").html(PrintTemplate);
}
alert("该发货通知单已成功下单,现在可以打印标签!");
};
function getCellValue(cell){
var value = Forguncy.Page.getCell(cell).getValue();
if(value == null){
value = "";
}
return value;
}
豪~豪
发表于 2024-5-29 16:41:25
正一味 发表于 2024-5-29 16:38
var p = Forguncy.Page;
var size = getCellValue("TemplateSize");
var ResultCode = getCellValue("ResultCode");
var PrintTemplate = getCellValue("PrintTemplate");
if (ResultCode == 100)
{
Forguncy.Page.getCell("PrintTemplate").setValue(PrintTemplate);
if(PrintTemplate != null){
$("").html(PrintTemplate);
Forguncy.Page.getCellByLocation('code').setValue(PrintTemplate);//创建活字格变量
}
alert("下单成功,请打印标签!");
};
if (ResultCode == 105)
{
alert(Reason);
};
if (ResultCode == 106)
{
Forguncy.Page.getCell("PrintTemplate").setValue(PrintTemplate);
if(PrintTemplate != null){
$("").html(PrintTemplate);
Forguncy.Page.getCellByLocation('code').setValue(PrintTemplate);//创建活字格变量
}
alert("该发货通知单已成功下单,现在可以打印标签!");
};
function getCellValue(cell){
var value = Forguncy.Page.getCell(cell).getValue();
if(value == null){
value = "";
}
return value;
}
活字格弹窗赋值改成=code
正一味
发表于 2024-5-29 16:55:02
豪~豪 发表于 2024-5-29 16:41
活字格弹窗赋值改成=code
谢谢大佬,这个设置成功了。麻烦你了!