Sunday, September 28, 2014

How to Add Hyperlinks to Link Data in Excel Worksheet inside Android Apps

This technical tip show how developers can add hyperlinks in Excel File to link data inside their Android applications using Aspose.Cell for Android.  A hyperlink links two entities. Everybody is familiar with hyperlinks because they are used extensively on the Internet. Using Aspose.Cells, developers can create different kinds of hyperlinks in Excel files. This article discusses what types of hyperlinks are supported in Aspose.Cells and how to use them. There are three kinds of hyperlinks which can be added into a cell using Aspose.Cells:

·         A link to a URL.
·         A link to another cell in the same file.
·         A link to an external file.

Aspose.Cells makes it possible to add hyperlinks to Excel files either using the API or designer spreadsheet (where hyperlinks are created manually and Aspose.Cells is then used to import them).  Aspose.Cells provides a class, Workbook that represents an Excel file. The Workbook class contains a WorksheetCollection that allows access to each worksheet in the Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides different methods for adding different types of hyperlinks to Excel files.

//A link to a URL

File sdDir = Environment.getExternalStorageDirectory();
String sdPath = sdDir.getCanonicalPath();

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet.
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.get(0);
HyperlinkCollection hyperlinks = sheet.getHyperlinks();

//Adding a hyperlink to a URL at "A1" cell
hyperlinks.add("A1",1,1,"http://www.aspose.com");

//Saving the Excel file
workbook.save(sdPath + "/book1.xls");

//In the above example, a URL is added to an empty cell, A1, as a hyperlink. When the cell is empty, the URL also becomes the link text. If a URL is added as a link to a cell that already contains text, then the hyperlink is added but the value of the cell looks like plain text. To make it look like a hyperlink, apply formatting on the cell.

File sdDir = Environment.getExternalStorageDirectory();
String sdPath = sdDir.getCanonicalPath();

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet.
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.get(0);

//Setting a value to the "A1" cell
Cells cells = sheet.getCells();
Cell cell = cells.get("A1");
cell.setValue("Visit Aspose");

//Setting the font color of the cell to Blue
Style style = cell.getStyle();
style.getFont().setColor(Color.getBlue());

//Setting the font of the cell to Single Underline
style.getFont().setUnderline(FontUnderlineType.SINGLE);
cell.setStyle(style);

HyperlinkCollection hyperlinks = sheet.getHyperlinks();

//Adding a hyperlink to a URL at "A1" cell
hyperlinks.add("A1",1,1,"http://www.aspose.com");

//Saving the Excel file
workbook.save(sdPath + "/book1.xls");

//Adding a Link to another Cell in the Same File

File sdDir = Environment.getExternalStorageDirectory();
String sdPath = sdDir.getCanonicalPath();

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet.
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.get(0);

//Setting a value to the "A1" cell
Cells cells = sheet.getCells();
Cell cell = cells.get("A1");
cell.setValue("Visit Aspose");

//Setting the font color of the cell to Blue
Style style = cell.getStyle();
style.getFont().setColor(Color.getBlue());

//Setting the font of the cell to Single Underline
style.getFont().setUnderline(FontUnderlineType.SINGLE);
cell.setStyle(style);

HyperlinkCollection hyperlinks = sheet.getHyperlinks();

//Adding an internal hyperlink to the "B9" cell of the other worksheet "Sheet2" in
//the same Excel file

hyperlinks.add("B3",1 ,1, "Sheet2!B9");

//Saving the Excel file
workbook.save(sdPath + "/book1.xls");

//Adding a Link to an External File

File sdDir = Environment.getExternalStorageDirectory();
String sdPath = sdDir.getCanonicalPath();

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet.
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.get(0);

//Setting a value to the "A1" cell
Cells cells = sheet.getCells();
Cell cell = cells.get("A1");
cell.setValue("Visit Aspose");

//Setting the font color of the cell to Blue
Style style = cell.getStyle();
style.getFont().setColor(Color.getBlue());

//Setting the font of the cell to Single Underline
style.getFont().setUnderline(FontUnderlineType.SINGLE);
cell.setStyle(style);

HyperlinkCollection hyperlinks = sheet.getHyperlinks();

//Adding a link to the external file
hyperlinks.add("A5", 1, 1, "C:\\book1.xls");

//Saving the Excel file
workbook.save(sdPath + "/book2.xls");

Overview: Aspose.Cells for Android

Aspose.Cells for Android is a MS Excel spreadsheet component that allows programmer to develop android applications for reading, writing & manipulate Excel spreadsheets (XLS, XLSX, XLSM, SpreadsheetML, CSV, tab delimited) and HTML file formats without needing to rely on Microsoft Excel. It supports robust formula calculation engine, pivot tables, VBA, workbook encryption, named ranges, custom charts, spreadsheet formatting, drawing objects like images, OLE objects & importing or creating charts.

Sunday, September 7, 2014

Extract/Replace Text in PDF File & PDF Pages to JPEG Conversion in Android

What's New in this Release?

Aspose development team is excited to announce the release of Aspose.Pdf for Android 1.4.0. This new release provides complete support for PdfConverter class and we also have introduced JpegDevice class. The JpegDevice class specifically provides the capabilities to convert PDF pages to JPEG format and provides high fidelity results. Furthermore, the PDF to Image conversion, Text extraction and Text replace are particular features enhanced in this release. In this new version, we have also provided the support to extract text using TextDevice class which was earlier supported in Aspose.Pdf for .NET and Aspose.Pdf for Java. The support for TrueType fonts is also enhanced and this API is not capable of handling complex scenarios for text replace feature. Some important features included in this new release are listed below
  • Extracting text using TextDevice
  • Text replace feature is much enahanced
  • Replace text is throwing outofmemory exception is now resolved
  • PDF to Image feature is now available
  • Facades: Replacing text is throwing exception is resolved
  • Error is resolved when converted file
  • Converted image quality is bad in comparison with .NET version and is now fixed
  • TrueType fonts are now accessible for standard fonts
  • File is conversion is enhanced and now correctly converted (lines are now visible)
  • Document with image is now correctly converted, issue are resolved
  • Logo "schufa" aren't displayed after conversion is now fixed
  • Enhanced conversion of logo, 2 lines and sign
  • Half image are displayed after conversion is now fixed
  • Table and photo are now displayed, issues are resolved
Overview: Aspose.Pdf for Android
Aspose.Pdf for Android is a PDF document creation & manipulation component that enables Android applications to read, write & manipulate PDF document without using any other third party application. It allows PDF compression options, table creation & manipulation, support for graph objects, extended security controls, custom font handling, add or remove bookmarks, create table of contents, add, update, delete attachments & annotations, import or export PDF form data, print PDF docs &  much more.

Wednesday, September 3, 2014

Add Vertical Text to HTML, EPUB & 3D Rendering Algorithms in Android

What's New in this Release?
 
Aspose development team is happy to announce the monthly release of Aspose.Words for Android 1.12.0.  This release sees the codebase better tweaked and the core functionality closer to Aspose.Words for Java/.NET 14.7.0, which is the product that Aspose.Words for Android is ported from. Here is a look at just a few of the biggest features and API changes in this month’s release. Improvements to DrawingML shadow, extrusion and 3D rendering algorithms, New public API to specify revision marks appearance for rendering, Vertical text is supported in HTML, MHTML and EPUB, Improvements to rendering and line wrapping for Arabic and Far East scripts, Improvements to rendering of inline shapes within rotated text and many more.  Images in PDF document now can be saved in CMYK color space. It is controlled by PdfSaveOptions.ImageColorSpaceExportMode property. If user wants to save images in PDF in CMYK color space, he can achieve this by using this release. Note that current implementation of CMYK support has some restrictions: JPEG codec is not supported; simple formula for RGB to CMYK conversion is used, no ICC profiles are supported. Priority property has been added to the FontSourceBase class. This property is used when there are fonts with the same family name and style in different font sources. The list of new and improved features added in this release are given below
  • Preserve Different First Page option during DOCX-HTML-DOCX roundtrip
  • Add a Priority property to FontSourceBase class
  • Add vertical text support to HTML\Epub
  • Add vertical text support to HTML Import
  • Text color is changed after conversion from ODT to Docx
  • Support relative measurement units on import and export
  • Provide a way to get the names of mustache fields in a document
  • Special characters are rendering as question marks in HTML
  • Save images in CMYK color space to PDF
  • Table border lost is fixed during importing MHTML
  • Incorrect image text wrapping type (inline) on html import
  • Consider preserving Cell height during converting HTML to Word documents
  • /table grid/ Incorrect table cell width on HTML to Tiff conversion, cell content wraps to the second line
  • Preserve Table.StyleName value during Word to Html to Word roundtrip
  • Provide options to control as to how Track Changes Text appears in PDF
  • Provide an ability to render only the Track Changes Revision Bars in Pdf
  • Consider including XML documentation in the NuGet package
  • /header truncated/ A Table in header is truncated when converting to Pdf
  • Converting Word to Pdf issue with RTL text
  • Provide an option to choose the formatting inside HTML or of DocumentBuiler
  • Footnote/Endnote character appears in the Bookmark in PDF
  • The arrow shape has incorrect fill in output document.
  • Improve font fallback for "MICR Encoding" font
  • Docx-HTML-Docx : BookmarkStart and BookmarkEnd position are changed
  • Narrow fonts rendered by Chrome looks wider than computed by AW in HtmlFixed format writer
  • First list label is formatted incorrectly after import.
  • Width of table is incorrect when use InsertHtml method.
  • RowFormat. LeftPadding/ RightPadding causes problem with table width during exporting to HTML.
  • List label attributes resolved incorrectly
  • Font is changed from Regular to Italic after inserting HTML to the document.
  • Table looks improperly in FireFox after expoerting DOCT to HTML
  • Extra column and lines in imported HTML tables
  • Images are replaced with “red cross” after open/save MHTML document.
  • Text in DIVs placement is corrected.
  • Extra Span with dir="rtl" is added during HTML export is now fixed.
  • Merged cells are not properly imported from HTML
  • Paragraph alignment “Justify Low” is changed to “Justified” after open/save.
  • Nested list 's formatting was disturbed and now fixed
  • Doc to html conversion problem with tables is resolved in this release
  • DrawingML misplacement in PDF is fixed in this release.
  • Need to ignore service elements with "display: none" css property on Html import
  • Aspose.Words for .NET 2.0 and 3.5 DLLs appear to depend on .NET 1.1
  • Doc to HTML conversion : Extra characters presence beside the table is fixed
  • Table cell needs to be hidden when exporting style=display:none to DOCX
  • Doc to Html conversion issue is resolved, extra spaces are fixed in output file
  • HTML writer incorrectly determines LocaleId and is now fixed
  • Tables are cutting at the right edge of page in PDF are corrected
  • Non-zero space after text inserted with DocumentBuilder.InsertHtml() is fixed
  • Aspose.Words now return correct values for Paragraph.ParagraphFormat properties.
  • Word control characters break document formatting when imported from HTML is now fixed
  • Unexpected characters appear in the output documents when importing MHTML is now fixed in this release.
  • Setting Table.AllowAutoFit value as false changes the cell's width is fixed
  • Table's border lost after re-saving the Doc file is now fixed
  • Table in the document body is split into 2 parts in Pdf is fixed
  • Saving a DOC multiple times corrupts Table layout is now corrected
  • Multilingual text rendering issue is resolved in Fixed file format (Tiff/Pdf)
  • A Shape is now visible in generated PDF
  • Contents move to next page after conversion from Doc to PDF is now fixed
  • Document.UpdateFields does not the SUM(ABOVE) field is fixed
  • Debug.Assert in the block of code which responsible for justification is fixed.
  • Trim leading/trailing spaces from merge field values during mail merge is fixed
  • Bookmark conversion issue is resolved with RTF to HTML
  • RemoveEmptyParagraphs changes the Paragraph spacing value
  • ODT to Docx conversion issue is resolved with list items
  • Textbox frame overlap the text after conversion from Docx to Pdf is now fixed
  • After resaving the Doc file, # sign is added before hyperlinks is fixed
  • Arrow (Shape) is changed after conversion from Docx to Pdf is now fixed
  • Docx to Doc conversion issue is fixed with table' row formatting
  • RTF to HTML conversion issue is resolved with OLE object icons
  • Error is resolved during printing Aspose.Words generated PostScript file
  • Paragraphs in a column of table are now preserved during open/save a DOCX
  • Header contents missing is fixed after re-saving the ODT
  • Table's cell layout issue is resolved while re-saving ODT
  • Contents of an [iframe] element get visible after HTML import is now fixed
  • Table border becomes visible during open/save a DOCX
  • Top margin issue is resolved after conversion from Docx to Pdf
  • A Word is rendered in multiple SPAN tags in HtmlFixed
Other most recent bug fixes are also included in this release

Overview: Aspose.Words for Android
Aspose.Words for Android is a Java word processing component that enables developers to generate, modify, convert and render Word documents within their Android applications. Aspose.Words supports DOC, DOCX, OOXML, RTF, HTML, XHTML, MHTML, OpenDocument, ODT, PDF, XPS, EPUB & other formats. Other useful features include document creation, content and formatting manipulation, mail merge abilities, reporting features, platform independence, performance & scalability all with minimal learning curve.