Size on print preview with row Height to small

Posted by: jbingenieriasoftware1921 on 8 November 2019, 4:57 am EST

    • Post Options:
    • Link

    Posted 8 November 2019, 4:57 am EST - Updated 30 September 2022, 4:41 am EST

    On spread_sheet is good the height of the row for logo jorbee

    but If I send to printer the height is to small

    I will send us my code

  • Posted 10 November 2019, 4:37 pm EST

    Hello,

    Sorry, I am not able to replicate the issue at my end. Could you please provide the stripped-down sample so that I can replicate the issue at my end assist you further.

    Thanks,

    Mohit

  • Posted 15 November 2019, 8:09 am EST

           private void btnImprimir_Click(object sender, EventArgs e)
            {
                FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo();             
                //pi.Header = "RESUMEN CORTES POR TURNO CEDA";
                pi.ShowGrid = false;
                pi.ShowBorder = false;
                pi.ShowPrintDialog = true;
                pi.BestFitWithSpan = true;
                pi.BestFitCols = true;
                pi.BestFitRows = true;
                pi.JobName = "Print Job Resumen Cortes por Turnos";
                pi.ShowColumnFooter = FarPoint.Win.Spread.PrintHeader.Hide;
                pi.ShowRowHeader = FarPoint.Win.Spread.PrintHeader.Hide;
                pi.ShowColumnHeader = FarPoint.Win.Spread.PrintHeader.Hide;
                pi.UseSmartPrint = true;
                pi.Images = new Image[] { Image.FromFile("C:\\Program Files (x86)\\jorbee\\LogoJorbee4.jpg") };
    
                //pi.Centering = Centering.Horizontal;
                FarPoint.Win.Spread.PrintMargin fpMargin = new FarPoint.Win.Spread.PrintMargin();
                fpMargin.Left = 0;
                fpMargin.Right = 0;
                fpMargin.Top = 25;
                fpMargin.Bottom = 1;
    
                pi.Margin = fpMargin;
                pi.Orientation = FarPoint.Win.Spread.PrintOrientation.Landscape;
                //if (pi.Orientation == PrintOrientation.Portrait)
                //{
                //    pi.PaperSize = new System.Drawing.Printing.PaperSize("Letter", 1000, 1500);
                //}
                int i = fpSpread1_Sheet1.RowCount + 6;
                pi.RowEnd = i;
                
                System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
                //pi.PaperSize = new System.Drawing.Printing.PaperSize("Letter", 1000, 1300);
    
                pi.ColStart = 0;            
                pi.RowStart = 0;            
                pi.PrintType = FarPoint.Win.Spread.PrintType.CellRange;
                pi.Opacity = 240;
    
                fpSpread1_Sheet1.PrintInfo = pi;
              
                fpSpread.ActiveSheet.PrintInfo.Preview = true;
                fpSpread.PrintSheet(fpSpread.ActiveSheet);
                //fpSpread1.PrintSheet(1);
            }
    
           private void SetupSheet(SheetView sheet)
            {
                SetSheetProperties(sheet);
    
                try
                {
                    sheet.AddSpanCell(0, 1, 1, 2);
                    sheet.AddSpanCell(0, 5, 1, 2);
                    sheet.AddSpanCell(1, 1, 1, 4); // 2do renglon
                    sheet.AddSpanCell(2, 1, 1, 4);
                    sheet.AddSpanCell(3, 1, 1, 2);
                    sheet.AddSpanCell(3, 5, 1, 2);
                    sheet.AddSpanCell(4, 1, 1, 3);
                    sheet.AddSpanCell(5, 1, 1, 2);
    
                    sheet.Cells[1, 1].Value = "RESUMEN DE TURNOS CEDA";
                    sheet.Cells[1, 1].Font = new Font("Calibri", 14, FontStyle.Regular);
    
                    FarPoint.Win.Spread.CellType.TextCellType t = new FarPoint.Win.Spread.CellType.TextCellType();
                    // Load an image file and set it to BackgroundImage property.
                    FarPoint.Win.Picture p = new FarPoint.Win.Picture(Image.FromFile("C:\\Program Files (x86)\\jorbee\\LogoJorbee4.jpg"), FarPoint.Win.RenderStyle.Stretch);
                    t.BackgroundImage = p;
                    // Apply the text cell.
                    fpSpread.ActiveSheet.Cells[0, 1].CellType = t;
                    // Set the size of the cell so the image is displayed
                    fpSpread.ActiveSheet.Rows[0].Height = 52;
                    //fpSpread.ActiveSheet.Columns[1].Width = 200;
    
                    sheet.Cells[0, 5].Value = DateTime.Now.ToString();
                    sheet.Cells[0, 5].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[0, 5].ForeColor = Color.FromArgb(64, 64, 64);
                    sheet.Cells[0, 5].HorizontalAlignment = CellHorizontalAlignment.Right;
                    sheet.Cells[0, 5].VerticalAlignment = CellVerticalAlignment.Bottom;
    
                    sheet.Cells[2, 1].Value = "INGRESOS CORRESPONDIENTES AL CORTE DEL DIA " + dateTimePicker1.Text;
                    sheet.Cells[2, 1].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[2, 1].ForeColor = Color.FromArgb(64, 64, 64);
    
                    sheet.Cells[2, 2].Value = dateTimePicker1.Text;
                    sheet.Cells[2, 2].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[2, 2].ForeColor = Color.FromArgb(64, 64, 64);
    
                    sheet.Cells[2, 3].Value = "TURNO: ";
                    sheet.Cells[2, 3].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[2, 3].ForeColor = Color.FromArgb(64, 64, 64);
    
                    sheet.Cells[2, 3].Value = cbxTurnos.Text;
                    sheet.Cells[2, 3].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[2, 3].ForeColor = Color.FromArgb(64, 64, 64);
    
    
                    sheet.Cells[3, 1].Value = "ACCESO: " + cbxAcceso.Text;
                    sheet.Cells[3, 1].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[3, 1].ForeColor = Color.FromArgb(64, 64, 64);
    
                    sheet.Cells[3, 2].Value = cbxTurnos.Text;
                    sheet.Cells[3, 2].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[3, 2].ForeColor = Color.FromArgb(64, 64, 64);
    
                    sheet.Cells[3, 5].Value = "USUARIO:" + cbxUsuario.Text;
                    sheet.Cells[3, 5].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[3, 5].ForeColor = Color.FromArgb(64, 64, 64);
    
                    sheet.Cells[3, 6].Value = cbxUsuario.Text;
                    sheet.Cells[3, 6].Font = new Font("Calibri", 9, FontStyle.Regular);
                    sheet.Cells[3, 6].ForeColor = Color.FromArgb(64, 64, 64);
    
                    sheet.Cells[4, 1].Value = "TURNO VESPERTINO DE 15:00:00 A 22:59:59";
                    sheet.Cells[4, 1].Font = new Font("Calibri", 10, FontStyle.Regular);
                    sheet.Cells[4, 1].ForeColor = Color.FromArgb(64, 64, 64);
                    //sheet.Cells[6, 2].Value = "TURNO VESP";
                    //sheet.Cells[6, 2].HorizontalAlignment = CellHorizontalAlignment.Left;
    
                    sheet.Cells[4, 1, 15, 1].HorizontalAlignment = CellHorizontalAlignment.Left;
                    sheet.Cells[5, 1, 15, 1].HorizontalAlignment = CellHorizontalAlignment.Left;
                    sheet.Cells[5, 1, 5, 7].Font = new Font("Calibri", 10, FontStyle.Bold);
                    sheet.Cells[5, 1, 5, 7].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, true, false, false); //left, right, top , bottom
    
                    //sheet.Cells[3, 1, 3, 2].Border  = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, false, true, false);
                    //sheet.Cells[5, 1, 1, 7].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, false, true, false);
                    sheet.Cells[5, 1, 15, 1].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, true, false, false, false);
                    sheet.Cells[5, 1, 100, 1].HorizontalAlignment = CellHorizontalAlignment.Left;
                    //BORDER PRIMER TABLA
                    //sheet.Cells[5, 1, 15, 7].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, false, true, false);
                    //sheet.Cells[6, 1, 14, 7].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, false, false, true);
    
                    sheet.Cells[5, 1, 5, 7].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, false, true, false);
    
                    sheet.Cells[1, 1, 1, 7].Border = new ComplexBorder(null, new ComplexBorderSide(Color.FromArgb(217, 217, 217), 1),
                       null, new ComplexBorderSide(Color.FromArgb(217, 217, 217), 3));
                    sheet.Cells[17, 1, 17, 7].Border = new ComplexBorder(null, new ComplexBorderSide(Color.FromArgb(217, 217, 217), 3),
                        null, new ComplexBorderSide(Color.FromArgb(217, 217, 217), 1));
    
    
                    //sheet.Cells[5, 1].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, true, true, false, false);
                    //sheet.Cells[5, 7].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, true, true, false);
                    //sheet.Cells[15, 1].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, true, false, false, true);
                    //sheet.Cells[15, 7].Border = new LineBorder(Color.FromArgb(217, 217, 217), 1, false, false, true, true);
    
                    CurrencyCellType currencyCell1 = new CurrencyCellType();
                    currencyCell1.DecimalPlaces = 2;
                    currencyCell1.Separator = ",";
                    currencyCell1.ShowSeparator = true;
    
                    CurrencyCellType currencyCell2 = new CurrencyCellType();
                    currencyCell2.DecimalPlaces = 2;
                    currencyCell2.NegativeRed = true;
    
                    PercentCellType percentCell1 = new PercentCellType();
                    percentCell1.DecimalPlaces = 0;
    
                    PercentCellType percentCell2 = new PercentCellType();
                    percentCell2.DecimalPlaces = 1;
                    percentCell2.NegativeRed = true;
    
                    FarPoint.Win.Spread.CellType.CurrencyCellType currcellNum = new FarPoint.Win.Spread.CellType.CurrencyCellType();
                    currcellNum.Separator = ",";
                    currcellNum.ShowCurrencySymbol = false;
                    currcellNum.ShowSeparator = true;
                    currcellNum.DecimalSeparator = ".";
    
                    currcellNum.DecimalPlaces = 0;
    
                    FarPoint.Win.Spread.CellType.DateTimeCellType datecell = new FarPoint.Win.Spread.CellType.DateTimeCellType();
                    datecell.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDateWithTime;
    
                    sheet.Columns[2].CellType = datecell;
                    sheet.Columns[3].CellType = datecell;
    
                    sheet.Columns[6].CellType = currcellNum;
                    sheet.Columns[7].CellType = currencyCell1;
    
                    //sheet.Cells[5, 3, 14, 5].CellType = currencyCell1;
                    //sheet.Cells[5, 6, 14, 6].CellType = percentCell1;
                    //sheet.Cells[15, 5].CellType = currencyCell2;
                    //sheet.Cells[15, 6].CellType = percentCell2;
                } catch (Exception)
                { }
            }
    
  • Posted 17 November 2019, 3:39 pm EST

    Hello,

    Could you please check after commenting the following line in your code:

    // pi.BestFitRows = true;

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels