I know that we can do conversion using aspose.Cells and Aspose. but is it possible to convert Word and Excel document simply by using Aspose.Pdf? The Aspose.Pdf has Save() method which takes a stream, if i just change the file extension and call save() with output stream will it work?
The Text file contains simple plain text and it does not include any special formatting information and Tags that describe the behavior of the document. If you open the Word or Excel worksheet in NotePad (or any other text editor) you will notice lots of formatting tags that describe the formatting be display of the PDF file. I am afraid Aspose.Pdf might not be able to convert Word and Excel files into PDF format. You need to use Aspose.Words to convert Word documents into PDF format and you need to use Aspose.Cells to convert Excel worksheets into PDF format.
In the event of any further query, please feel free to contact.
Thanks for th reply. I have one more question though. I tried converting Excel to PDF using Aspose.cells. It converts fine but it splits certain number of columns and put them on to different pages. So if the excel file has 10 columns, then the converted pdf has first 5 columns and the rows and then remaining 5 columns and the rows.
How do you handle such senarios and put all the columns together? Can you shrink the font size and landscape it?
As the query is related to Aspose.Cells, so I will be moving it Aspose.Cells forum where I believe our team of experts taking care of this product would be in better position to answer this question. Please be patient and spare us little time. We apologize for your inconvenience.
Well, you do not need to assign the ImageOrPrintOptions options, it will be done automatically (implicitly) as you only need to specify/set the SaveFormat attribute (to set to i.e. SaveFormat.Pdf) of it.
If you find any issue with the output PDF file regarding the example code, let us know with the input and output files.
I think im still not getting it. We set the SaveFormat property of the ImageOption
imgOptions.SaveFormat = SaveFormat.Pdf;
And then there is no association between instance of workbook and instance of ImageOrPrintOptions, So how workbook instance knows which imgOption to use?
i'm just confused in deciding which option should i use. Should i use FitToPagesTall,FitToPagesWide option or ImageOrPrintOption? and if i use ImageOrPrintOption how the ImageOrPrintOption works?
//this code is not working, it only generates blank PDF
Aspose.Cells.Workbook document = new Aspose.Cells.Workbook(inputStream);
Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
imgOptions.OnePagePerSheet = true;
imgOptions.SaveFormat = Aspose.Cells.SaveFormat.Pdf;
document.Save(outputStream, Aspose.Cells.SaveFormat.Pdf);
//this seems to be working, Is this correct code??
Aspose.Cells.Workbook document = new Aspose.Cells.Workbook(inputStream);
foreach (Aspose.Cells.Worksheet ws in document.Worksheets)
{
ws.PageSetup.FitToPagesTall = 0;
ws.PageSetup.FitToPagesWide = 1;
}
document.Save(outputStream, Aspose.Cells.SaveFormat.Pdf);
ImageOrPrintOptions has nothing to do with creating pdf. It is used for rendering images.
I have written a code example to explain to you what Worksheet.PageSetup.FitToPagesWide. Please see the output pdf and the comments, it will explain everything.