// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java String srcDir = Utils.Get_SourceDirectory(); String outDir = Utils.Get_OutputDirectory(); // Open an Excel file. Workbook workbook = new Workbook( srcDir + "sampleSetDefaultFontPropertyOfPdfSaveOptionsAndImageOrPrintOptions.xlsx"); // Rendering to PNG file format while setting the // CheckWorkbookDefaultFont attribute to false. // So, "Times New Roman" font would be used for any missing (not // installed) font in the workbook. ImageOrPrintOptions imgOpt = new ImageOrPrintOptions(); imgOpt.setImageType(ImageType.PNG); imgOpt.setCheckWorkbookDefaultFont(false); imgOpt.setDefaultFont("Times New Roman"); SheetRender sr = new SheetRender(workbook.getWorksheets().get(0), imgOpt); sr.toImage(0, outDir + "outputSetDefaultFontProperty_ImagePNG.png"); // Rendering to TIFF file format while setting the // CheckWorkbookDefaultFont attribute to false. // So, "Times New Roman" font would be used for any missing (not // installed) font in the workbook. imgOpt.setImageType(ImageType.TIFF); WorkbookRender wr = new WorkbookRender(workbook, imgOpt); wr.toImage(outDir + "outputSetDefaultFontProperty_ImageTIFF.tiff"); // Rendering to PDF file format while setting the // CheckWorkbookDefaultFont attribute to false. // So, "Times New Roman" font would be used for any missing (not // installed) font in the workbook. PdfSaveOptions saveOptions = new PdfSaveOptions(); saveOptions.setDefaultFont("Times New Roman"); saveOptions.setCheckWorkbookDefaultFont(false); workbook.save(outDir + "outputSetDefaultFontProperty_PDF.pdf", saveOptions);