Make the Creation of Aspose Documents easier
The Aspose.Pdf.Generator.Text class contains a property called IsHtmlTagSupportedwhich makes it possible to add HTML tags/contents into PDF files. The added content is rendered in native HTML tags instead of appearing as a simple text string. To support a similar feature in the new Document Object Model (DOM) of the Aspose.Pdf namespace, the HtmlFragment class has been introduced.
// Instantiate Document object Document doc = new Document(); // Add a page to pages collection of PDF file Page page = doc.Pages.Add(); // Instantiate HtmlFragment with HTML contnets HtmlFragment titel = new HtmlFragment("<fontsize=10><b><i>Table</i></b></fontsize>"); // Set bottom margin information titel.Margin.Bottom = 10; // Set top margin information titel.Margin.Top = 200; // Add HTML Fragment to paragraphs collection of page page.Paragraphs.Add(titel); // Save PDF file doc.Save("outputlpdf");
The steps below creates the Hello World application using the Aspose.Cells API:
- Create an instance of the [{{Workbook}}] class.
- If you have a license, then apply it.
If you are using the evaluation version, skip the license related code lines. - Create a new Excel file, or open an existing Excel file.
- Access any desired cell of a worksheet in the Excel file.
- Insert the words Hello World! into a cell accessed.
- Generate the modified Microsoft Excel file.
//Create a License object License license = new License(); //Set the license of Aspose.Cells to avoid the evaluation //limitations license.SetLicense("Aspose.Cells.lic"); //Instantiate a Workbook object that represents Excel file. Workbook wb = new Workbook(); //Note when you create a new workbook, a default worksheet //"Sheet1" is added (by default) to the workbook. //Access the first worksheet "Sheet1" in the book. Worksheet sheet = wb.Worksheets[0]; //Access the "A1" cell in the sheet. Cell cell = sheet.Cells["A1"]; //Input the "Hello World!" text into the "A1" cell cell.PutValue("Hello World!"); //Save the Excel file. wb.Save("d:\\MyBook.xls", SaveFormat.Excel97To2003);