1

複数回繰り返した後、次のコードがあります。どれも機能しません。これは、DYMO から直接の例と、ここに投稿された他の質問に基づいて取得しました。まだ何も機能していません。ボタンを押しても何の反応もありません。

<input id="btnUnitPrint" type="button" value="Print Unit Label" onclick = "printunitLabel()"/><br />
<input id="btnOrderPrint" type="button" value="Print Order Label" onclick = "printorderLabel()"/><br />
<script type="text/javascript">  
    function printunitLabel() {

        var printer = dymo.label.framework.getLabelWriterPrinters()[0].modelName;
        printerName = printer.name; 

        var label = DYMO.Label.Framework.Label.Open("UnitLabel.label");
        var company = document.getElementById('<%= txtcompany.Text %>').value;
        var customer = document.getElementById('<%= txtcustomer.Text %>').value;
        var serial = document.getElementById('<%= txtserial.Text %>').value;
        var unit = document.getElementById('<%= txtunit_manuf.Text + txtunit_model.Text %>').value;
        var warranty = document.getElementById('<%= ddlWarranty.Text %>').value;
        label.SetObjectText("lblcompany", company);
        label.SetObjectText("lblcustomer", customer);
        label.SetObjectText("lblserial", serial);
        label.SetObjectText("lblunit", unit);
        label.SetObjectText("txtWarranty", warranty);

        label.print(printerName);
    }  
    function printorderLabel() {

        var printer = dymo.label.framework.getLabelWriterPrinters()[0].modelName;
        printerName = printer.name;

        var label = DYMO.Label.Framework.Label.Open("OrderLabel.label");
        var company = document.getElementById('<%= txtcompany.Text %>').value;
        var customer = document.getElementById('<%= txtcustomer.Text %>').value;
        var order = document.getElementById('<%= txtorder_id.Text %>').value;
        label.SetObjectText("lblcompany", company);
        label.SetObjectText("lblcustomer", customer);
        label.SetObjectText("lblorder", order);
        label.Print(printer);

        label.print(printerName);
    } 
</script>

更新、このパネルには、ラベル テンプレートに渡すすべての変数が含まれています。

<asp:Panel ID="confirmation_panel" runat="server" Height="457px" Style="margin-right: 0px" Width="1040px" BorderStyle="Double" BorderWidth="2px">
    <br />
    <table style="width: 469px; height: 385px;">
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="lblorder_id" runat="server" Text="Order ID:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtorder_id" runat="server" ReadOnly="True" Width="231px" Height="22px" ></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="lblunit_id" runat="server" Text="Unit ID:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtunit_id" runat="server" ReadOnly="True" Width="231px" Height="22px" ></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="Label5" runat="server" Text="Company Name:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtcompany" runat="server" ReadOnly="True" Width="231px" Height="22px" NullDisplayText=""></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="Label6" runat="server" Text="Client Name:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtcustomer" runat="server" ReadOnly="True" Width="231px" Height="22px" ></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="lblunit_manuf" runat="server" Text="Unit Manufacturer:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtunit_manuf" runat="server" ReadOnly="True" Width="231px" Height="22px" ></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="lblunit_model" runat="server" Text="Unit Model:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtunit_model" runat="server" ReadOnly="True" Width="231px" Height="22px" ForeColor="Red"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="lblserial" runat="server" Text="Serial Number:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtserial" runat="server" ReadOnly="True" Width="231px" Height="22px" ForeColor="Red"></asp:TextBox>
            </td>
        </tr>
         <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="lblWUserial" runat="server" Text="Whole Unit Serial Number:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:TextBox ID="txtWUserial" runat="server" ReadOnly="True" Width="231px" Height="22px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="modal-sm" style="width: 1231px">
                <asp:Label ID="lblwarranty" runat="server" Text="Warranty Status:"></asp:Label>
            </td>
            <td style="height: 34px; width: 326px;">
                <asp:DropDownList ID="ddlWarranty" Width="231px" Height="22px" runat="server">
                    <asp:ListItem>Warranty Expired</asp:ListItem>
                    <asp:ListItem>Warranty Active</asp:ListItem>
                    <asp:ListItem>N/A</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        </table>
</asp:Panel>
4

1 に答える 1