Printing gridweb content from excel not working(ver aspose-2.5.3.2006)

Hi,

The above code works fine (printing the content in the excel sheet from the browser IE9) if I run my project locally (`http://localhost:2627/tech_23june2011/Default.aspx`) . But if I run remotely (`http://10.10.210.97/tech_23june2011/Default.aspx`) it throws error Aspose.cells.CellsException : Default printer is not set . Printer not found! For the error message please find the attached file.

The problem is : when the client click the print button , the serverside code cannot find the client’s default printername or path. I don’t know how to find client default printer name with path.

Can you please suggest a solution for this? Its very very urgent.

Code:

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. //Response.End(); // string filename = "c:\\one.xls";

Workbook workbook = new Workbook();

workbook.Open(filename); //Page settings

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

workbook.Worksheets[0].PageSetup.Orientation = PageOrientationType.Landscape; workbook.Worksheets[0].PageSetup.PaperSize = PaperSizeType.PaperA3; 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; //Add NT logo in the A1 cell of the excel sheet

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

workbook.Save(filename);

PrinterSettings settings = new PrinterSettings();

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

Many Thanks,

Assal.

Hi,

Thanks for reporting this problem.

I have logged your issue in our database. We will investigate your problem and update you asap.

This issue has been logged as CELLSNET-29087.

Hi,

Have got any updates?

Many Thanks,
Assal

Hi,

The problem is : when the client click the print button , the serverside code cannot find the client’s default printername or path. I don’t know how to find client default printer name with path.

It’s impossible that directly printing file on the server to the client.

As gridweb could not support pagesetup, please export the file to image on the server with Aspose.Cells, send the images to the client, then print the images to the printer on the client.

Hi,

Question 1:When user clicks the print button, the content from the Gridweb controls has converted in to excel file with formatting in client’s local machine successfully.But how to print that excel file (ie) how to find default printer name.

workbook.Open(“c:\one.xls”);

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


Question 2: In the "Aspose.pdf for .net" product you have shown how to print the pdf file in the default printer using PdfViewer class(http://www.aspose.com/documentation/.net-components/aspose.pdf-for-.net/printing-pdf-file-to-default-printer-using-printer-and-page-settings-facades.html). Similarly can you please tell me how to print the Excel file in the default printer using "Aspose.Cells.GridWeb" or "Aspose.Cells" product.


Many Thanks,

Assal








Hi,
Have you got any updates on this please? Its urgent please.

Many Thanks,
Assal

Hi,

I have added your question and requirement in our database. We will update you once we will get some update regarding it. Thanks for your patience.

Hi,
Have you got any updates ? It is urgent requirement please

Many Thanks,
Assal.

Hi,

Unfortunately, there is no update. I have increased the priority and also added your comment. Thanks for your patience.

Hi,

The attached demo illustrates how to use Aspose.Cells to render image on a browser on server side.

Hi ,

I tried
your method for printing, but the below properties are not set. When i
take the printout the image quality is not good and it is very small.

sheet.PageSetup.FitToPagesWide = 1;

sheet.PageSetup.Orientation =
PageOrientationType.Landscape;

sheet.PageSetup.PaperSize = PaperSizeType.PaperA4;

sheet.PageSetup.HeaderMargin = 0.7;

sheet.PageSetup.TopMargin = 1.1;

sheet.PageSetup.LeftMargin = 0.9;

sheet.PageSetup.RightMargin = 0.9;

sheet.PageSetup.BottomMargin = 0.8;

sheet.PageSetup.FooterMargin = 0.5;

I’ve attached my sample code and excel file to be printed. Can you please suggest any solution for this please?

(Run my printing.aspx file )

This feature is very important in out development.

Please check and reply me as soon as possible

Thanks in advance

Hi there,
Have you got any updates please? It is urgent please.

Many Thanks,
Assal

Hi,
Have you got any updates? It is very
urgent
. This is the only one functionality we are lagging in our
project. Please help us to solve the issue as soon as possible.

Many Thanks,
Assal

Hi,

Please try the demo code using the latest version: Aspose.Cells.GridWeb
v2.6.1.2002
and let us know your feedback.