Страницы: 1
Just include it using a <script> tag in your XUL file like this:
<script type="application/x-javascript" src="chrome://global/content/printUtils.js"/>
Next, make your <iframe type="content" ... />
Last, to print the contents of the <iframe> use the following:
PrintUtils.print();
Look in the ".print()" method for how it owrks, but basically, since your <iframe> is type="content", the code in ".print()" can find the right stuff to print. You can modify the ".print()" if you need to and if you do, then make a copy to include in your project.
Добавлено 30-05-2009 15:16:03
И можете посмотреть на это расширение
Do not meddle in the affairs of Wizards, for they are subtle and quick to anger.
Отсутствует
что-то похожее, но не iframe, вот xul-файлик:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="example-window" title="Example 2.7.1"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
function last_rep(){
document.getElementById('last_report').style.visibility='visible';
document.getElementById('Data_vvod').style.visibility='hidden';
document.getElementById('Declaimer_vvod').style.visibility='hidden';
document.getElementById('alg_list').style.visibility='hidden';
document.getElementById('tester_vvod').style.visibility='hidden';
}
</script>
<script src="forma.js" type="application/x-javascript"/>
<script type="application/x-javascript" src="chrome://global/content/printUtils.js"/>
<hbox>
<menubar>
<vbox>
<label control="rep_label" accesskey="" value="Выбрать тип отчета"/>
<menulist>
<menupopup >
<menuitem id="vibor" label="Последний отчет" oncommand="last_rep()"/>
<menuitem id="vibor1" label="По дате" oncommand="po_date()"/>
<menuitem id="vibor2" label="По заявителю" oncommand="po_decl()"/>
</menupopup>
</menulist>
<vbox id="alg_list" style="visibility:hidden">
<label control="alg_label" accesskey="" value="Выбрать алгоритм"/>
<menulist>
</menulist>
</vbox>
</vbox>
<vbox id="Data_vvod" style="visibility:hidden">
<label control="buddy control id" accesskey="" value="Дата"/>
<textbox id="2taxt" value="" onchange="chek()"/>
</vbox>
<vbox id="Declaimer_vvod" style="visibility:hidden">
<label control="buddy control id" accesskey="" value="Заявитель"/>
<textbox value="" />
</vbox>
<vbox id="tester_vvod" style="visibility:hidden">
<label control="buddy control id" accesskey="" value="Тестировщик"/>
<textbox value=""/>
</vbox>
</menubar>
</hbox>
<grid id="last_report" style="visibility:hidden">
<rows>
<row />
</rows>
<columns>
<column flex="1">
<label crop="center" style="font-size:2em"><spacer width="300" />ОТЧЕТ </label>
<label> <spacer width="250"/> 8888 </label>
<label>
<separator style="height:2em" />
1111111
</label>
<label><separator style="height:2em" />
Итоги <spacer width="100"/> 22222
</label>
<label>
<separator style="height:2em" />
33333
</label>
<label style="font-size:1em">
<separator style="height:2em" />
Время получения отчета
</label>
</column>
</columns>
</grid>
<hbox>
<button label="Распечатать отчет" onclick="PrintUtils.print()"/>
</hbox>
</window>
распечатать надо таблицу, т.е. данные заключенные между тегами grid, причем при нажатии на кнопку "Распечатать отчет". help plz
Отсутствует
Страницы: 1