We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image support in Aspose.Words for Java

Hi,
We have just brought a copy of Aspose.Words for Java and I have noticed that images are being removed when saving the document after performing an update. Looking at past forums I noticed that this was a known issue. Is this still the case?. I am using version 2.1.0.0 which I downloaded on 7/6/2007.
I have attached the code and word documents for your reference
Cheers

package mypackage1;
import com.aspose.words.*;
import java.sql.*;
import java.io.*;
import oracle.jdbc.*;
import java.text.Format;
import java.text.DecimalFormat;
import java.text.*;

public class WordTest
{
    public WordTest()
    {
    }

    public static void main(String [] args)
    {

        try
        {
            com.aspose.words.License license = new com.aspose.words.License();
            license.setLicense("c:/Aspose.Words.lic");

            Document doc = new Document("c:/FOP For Non-Commercial Thinning.doc");

            String sqlStatement = "";

            DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
            Connection conn =
                    DriverManager.getConnection();

            Statement st = conn.createStatement();
            ResultSet results;
            String[] fieldnames = doc.getMailMerge().getFieldNames();

            results = st.executeQuery("select b.operator as contractor,asset_name as assetname,c.short_description as assetowner,b.planned_net_quantity as plannednetquantity,b.operation_id as operationid, d.planned_retained_spha as plannedretainedspha, e.short_description as fallingmethod from asset a,operation b, asset_owner_lookup c ,non_commercial_thinning d, nct_method_lookup e where a.asset_id = b.asset_id and a.asset_owner_code = c.asset_owner_code (+) and b.operation_id = d.operation_id "+
                    " and d.falling_method = e.method_code (+) and b.operation_id = 406367" );

            doc.getMailMerge().executeWithRegions("NonCommThin",results);

            results = st.executeQuery("select b.operator as contractor,to_char(b.operation_start_date,'dd/mm/yyyy') as operationdate,d.distname as district from asset a,operation b,block c,districtro d where a.asset_id = b.asset_id "+
                    " and a.block_id = c.block_id and c.district_code = d.distcode and b.operation_id = 406367" );

            doc.getMailMerge().execute(results);

            doc.save("C:/newword.doc");

        }
        catch (Exception e) {System.out.println(e.toString());}

    }
}

Hi,
Thank you for reporting the issue to us. I have notified our Java developer and he will reply to you shortly.

Hi,
I have tested your file – images do not disappear. Although I can’t emulate exactly your DB, but it is not a case because images do not participate in mailmerge. Can you check the simplified test:

Document doc = new Document(“X:\ FOP for Non-Commercial Thinning.doc”);
doc.save(“X:\ FOP for Non-Commercial Thinning Out.doc”);

Best Regards,

Hi,
I have simplified the test program to as follows

package mypackage1;
import com.aspose.words.*;

public class WordTest
{
    public WordTest()
    {
    }

    public static void main(String [] args)
    {

        try
        {
            com.aspose.words.License license = new com.aspose.words.License();
            license.setLicense("c:/Aspose.Words.lic");

            Document doc = new Document("c:/FOP For Non-Commercial Thinning.doc");

            doc.save("C:/newword.doc");
        }
        catch (Exception e) {System.out.println(e.toString());}

    }
}

So I am now only using the one import which is essentially using Aspose.Words.jdk15.jar however it is still removing images. I have attached the saved word document as confirmation. The java version I am using is 1.5.0_06.
Just confirming that I have the latest copy of the library jars (Aspose.Words.jdk15.jar), they were built on the 14/04/2007
I have also tried building and running this case using java 1.4 with the Aspose.Words.jdk14.jar with the same results.
Thanks

Hi,
What version of Word are you using? I can see images in the attached doc – Forestry Tasmania logos – two in footers of the first and the second pages and one inline in the second page – all as in the template document. Are there other images in the doc? (Though I do not see other images).
Regards,

Hi,
We are using Microsoft Word 97 SR-2. The operating system is Windows 2000 Version 5.0.2195 SP 4.
The only logos in the document are the Forestry Tasmania logos which you can see in the saved document, but we can’t . This is obviously pointing to the version of word we are using? Is this not supported?
Cheers

Hi,
We keep looking into this issue. Word 97 documents are supported by Aspose.Words and no data should be lost. We will get back to you ASAP.
Thanks.

We’ve succeeded to reproduce the issue and I have registered it as #3193. We will be looking into into it very soon.
Thanks.

Hi,
Have you an idea as to when a solution is likely to be available? I am starting to be questioned by managment as to the timing of a solution
Thanks

Hi,
The solution will be release within this week.
Best Regards,

Hi,
I have just downloaded aspose.words 2.3 for java and it appears that this image problem is still present , i.e. the image isn’t being included in the word document. Can you confirm if this problem has been fixed, and if so which jar has the fix in it
Thanks

Hi,
Sorry for disinformation:(
Bunch of word97+images errors was fixed in the last release, but your one still don’t fixed in java release. However, this error already fixed in .Net baseline and fix will be ported to java nearest maintenance release (approximately December-January).
Best Regards,

Has this bug been fixed? I have tried the 2.4.0.0 version of Aspose.Words for Java and I have found the same issue with the images.

The problem is only present in Word 97 SR-2. Other versions of Word seem to be working fine.

Hi,
Sorry, the 2.4.0.0 release and even next 2.4.1 release (will be published within 2 weeks) do not include the fix of your bugL. The fix will be included in 2.4.2 that scheduled to release on March.
I’m sorry again – as it turned out the bug’s fix affects a lot of cross-connected classes in two different modules – so we can’t fix just this bug, we have to wait for the next maintenance release (2.4.2).
Best Regards,

Any update on this? The 2.4.2 release didn’t seem to work either.

Hi
Thanks for your inquiry. Unfortunately your issue was not fixed in 2.4.2 version. This issue will be fixed in the next java release. We plan to release the next Aspose.Words for java version within 1-2 months.
Best regards.

Hi
We are happy to tell you that we released new version of Aspose.Words for java. This version includes fix of issue you found earlier (issue # 3193). You can download new version from here:
https://releases.aspose.com/words/net
Best regards.