BMC Remedy 9.0 で参加フォームの内容を印刷する方法がわかりません。Remedy のドキュメントでは、フォームの結合ではなく、レポートの印刷についてのみ説明しています。Ctrl-P を使用するか、内部の Remedy プロセス/アクション リンクを使用して印刷できるようにしたいと考えています。私の結合フォームには、ほとんど文字フィールドが含まれています。ページの幅が 915 ピクセル、高さが 1000 ピクセルであるにもかかわらず、印刷プレビューの高さが最初の ~20 ピクセルで切り捨てられます。ブラウザでフォームを印刷する方法を知っている人はいますか?
1 に答える
0
これを行う方法を考え出しました - すべてのコンテンツを WYSIWYG 経由で Remedy パネル オブジェクト内に配置する場合、Web フッターにスクリプトを追加して、document.body.innerHTML をパネルの innerHTML と等しく設定できます。このちょっとしたトリックにより、window.print() または Ctrl-P を使用してページを印刷できるように要素が編成されます。ただし、この innerHTML の割り当てにより、子テキストエリアや入力値などのプロパティが破損したり失われたりすることが多いことに注意してください。したがって、これらの値をスクレイピングして、印刷する前にページに追加する必要があります。
<div>
<script>
function myPrint()
{
var idTexts = [];
var textareas = document.querySelectorAll('textarea[id][readonly]');
for(var i = 0; i < textareas.length; i++)
{
idTexts.push(textareas[i].id);
idTexts.push(textareas[i].value);
}
var inputs = document.querySelectorAll('input[id][readonly]');
for(var i = 0; i < inputs.length; i++)
{
idTexts.push(inputs[i].id);
idTexts.push(inputs[i].value);
}
//Assume there is only one panel object, so only one .pnl class on the page
var printContents = document.querySelector('.pnl').innerHTML;
document.body.innerHTML = printContents;
for(var i = 0; i < idTexts.length; i++)
{
if(document.getElementById(idTexts[i]))
{
document.getElementById(idTexts[i]).value = idTexts[i+1];
}
}
window.print();
}
/*On page load, I noticed the click event fired for a visible button
without the user actually needing to click.
Will not work unless the button's visibility is set to true (Remedy is a weird creature).
Used the setTimeout to allow time for the initial page load, as the onload event fired too early.
If you don't want this button to appear on the page when it is printed
overlay a transparent image on the button's display properties.*/
document.querySelector('a[ardbn="btnPrintMe"]').onclick = setTimeout(function(){ myPrint(); }, 500);
</script>
</div>
それでも印刷に問題がある場合は、この btnPrintMe ボタンに少なくとも 1101/-1101、1102/-1102、1103/-1103 の正しい 6 つの権限があり、これをテストしているユーザーにも適切な権限があることを確認してください。
于 2015-12-07T22:22:06.557 に答える