How to Create Word Document Editor in Android App

Hi Good day,

How can I create an word document editor in my android app using aspose.word product any ideas and advice.

Thanks

@antonio91canillas,

Please note that Aspose.Words for Android via Java is a class library and with it you can programmatically generate, modify, convert and render word processing documents. So, it does not offer any UI or control for performing these document processing tasks. However, if you are intended to just preview your Word document in your android application, we can offer you a simple way that will help you in achieving what you are looking for.

  • Load your Word document by using ‘Aspose.Words for Android via Java’
  • Generate images against each page in Word document and then view them in some android control

Please see the following code that uses standard ImageView widget to show Aspose.Words generated images:

try
{
    String licString = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Aspose.Words.Android.lic";
    String inputPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/input.docx";
    String outputPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";

    com.aspose.words.License lic = new com.aspose.words.License();
    lic.setLicense(licString, this);

    com.aspose.words.Document doc = new com.aspose.words.Document(inputPath);
    com.aspose.words.ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);
    options.setPageCount(1);

    for (int i = 0; i < doc.getPageCount(); i++) {
        options.setPageIndex(i);
        doc.save(outputPath + "out_" + i + ".png", options);
    }

    Bitmap bm = BitmapFactory.decodeFile(outputPath + "out_1.png");

    ImageView img = (ImageView) findViewById(R.id.imageView1);
    img.setImageBitmap(bm);
}
catch (Exception e)
{
    e.printStackTrace();
}

Hope, this helps.