Printing is working fine but some borders missing(

Hi,

I'm using the code in Linkbutton click event to transfer my grid content to excel and format it and to print it. What happens is, if i click the link button i'll get the printout with some border missing as in the attached file. But i manually open the excel sheet (excel_filewith_formatting.xls) and print it directly from the generated excel file from the code below , it is perfect with all borders .

Can you please suggest any solution for this. It is urgent

protected void LinkButton1_Click1(object sender, EventArgs e)

{ string filename = "c:\\one.xls"; // Saves to the file.

this.g.WebWorksheets.SaveToExcelFile(filename); // Sents the file to browser.

Response.ContentType = "application/vnd.ms-excel"; //Adds header.

Response.AddHeader("content-disposition", "attachment; filename=book1.xls"); // Writes file

content to the response stream. Response.WriteFile(filename); // OK.

Workbook workbook = new Workbook(filename);

workbook.Worksheets[0].PageSetup.FitToPagesWide = 1;

workbook.Worksheets[0].PageSetup.Orientation = PageOrientationType.Landscape;

workbook.Worksheets[0].PageSetup.PaperSize = PaperSizeType.PaperA4;

workbook.Worksheets[0].PageSetup.HeaderMargin = 0.7;

workbook.Worksheets[0].PageSetup.TopMargin = 1.1;

workbook.Worksheets[0].PageSetup.LeftMargin = 0.9;

workbook.Worksheets[0].PageSetup.RightMargin = 0.9;

workbook.Worksheets[0].PageSetup.BottomMargin = 0.8;

workbook.Worksheets[0].PageSetup.FooterMargin = 0.5;

workbook.Worksheets[0].Pictures.Add(0, 0, @"C:\inetpub\wwwroot\tech_23june2011\Images\NTLogo3.gif");

workbook.Save(filename, SaveFormat.Excel97To2003);

workbook.Open(filename);

PrinterSettings settings = new PrinterSettings();

workbook.Worksheets[0].SheetToPrinter(settings.PrinterName);

}

Many Thanks,

Assal

Hi,

Please download the latest version. I generated the image with it and it is fine.[no borders missing]

Download Link: Aspose.Cells
for .NET v6.0.0.2


Please see the code below and the output image.

C#


string path = @“F:\Shak-Data-RW\Downloads\Files\excel_filewith_formating.xls”;

Workbook workbook = new Workbook(path);


Worksheet worksheet = workbook.Worksheets[0];


//Apply different Image / Print options.

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

options.ImageFormat = ImageFormat.Tiff;

options.OnePagePerSheet = true;


SheetRender sr = new SheetRender(worksheet, options);


Bitmap bitmap = sr.ToImage(0);


bitmap.Save(path + “out.jpg”, ImageFormat.Jpeg);


Screenshot: