简体   繁体   中英

Windows Presentation Foundation Print Label (Zebra Printer)

I am trying to print text to display vertical in Windows Forms Host. The label is printing with report viewer in WPF. Here is my code:

// boolean is based on true or false, when printing labels    
private bool _isReportViewerLoaded;

// method to display data in .rdlc
private void ReportViewer_Load(object sender, EventArgs e)
    {
        // if equal false run this code isReportViewerLoaded 
        if (!_isReportViewerLoaded)
        {
            // get the lot based on the parameter Id
            Lot lot = BottleLotRespository.GetLotById(this.Parameter);

            // settings the page settings
            PageSettings pg = new PageSettings();
                         pg.PrinterSettings
                           .DefaultPageSettings
                           .Margins = new Margins(0, 0, 0, 0);
                         pg.Landscape = false;


            PaperSize size = new PaperSize("110.0 x 74.0", 433, 100);

            BottleLotDataSet bottleLotDataSet                   = new BottleLotDataSet();
            DataTable reportDataTable                           = bottleLotDataSet.LotDataTable;
            DataRow lotRow                                      = reportDataTable.NewRow();
            lotRow["Id"]                                        = lot.Id;
            lotRow["Number"]                                    = lot.Number.ToString();

            reportDataTable.Rows
                           .Add(lotRow);

            bottleLotDataSet.BeginInit();                       

            this._reportViewer.SetPageSettings(pg);
            this.reportDataSource.Name                          = "DataSet1";
            this.reportDataSource.Value                         = reportDataTable;

            this._reportViewer
                .LocalReport
                .DataSources
                .Add(this.reportDataSource);
            this._reportViewer
                .LocalReport
                .ReportEmbeddedResource                         = "BottleLotWPF.View.Report1.rdlc";

            bottleLotDataSet.EndInit(); 

            _reportViewer.RefreshReport();

            _isReportViewerLoaded = true;
        }
    }

My problem is that the Report1.rdlc is not allowing me to rotate the text and there is no settings for it. Is there away of adding a setting to it to rotate the text?

In RDLC we have the option to print vertically it seems. please take look at the existing thread here and see if it helps.

display-text-vertically-start-

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM