java.lang.IllegalArgumentException: Cannot find required font defination

Last post 11-18-2011, 12:49 AM by Amjad Sahi. 18 replies.
Page 1 of 2 (19 items)   1 2 Next >
Sort Posts: Previous Next
  •  11-09-2011, 10:19 PM 341188

    java.lang.IllegalArgumentException: Cannot find required font defination Java

    executing the procedure

    public static void Sav(String p_file_path, String p_sheet, String p_cell_in, String p_cell_out, float p_val) throws Exception
     {    
      
        Workbook workbook = new Workbook(p_file_path);
       
        Cells cells = workbook.getWorksheets().get(p_sheet).getCells();

        Cell cell_in = cells.get(p_cell_in);

        cell_in.putValue(p_val);    
       
        workbook.save(p_file_path);

    }

    I'm getting this error:

    java.lang.IllegalArgumentException: Cannot find required font defination[Family:Arial, Style:1]. Please specify font path.
     at com.aspose.cells.a.c.cf.b(Unknown Source)
     at com.aspose.cells.a.c.cf.a(Unknown Source)
     at com.aspose.cells.t.a(Unknown Source)
     at com.aspose.cells.pM.a(Unknown Source)
     at com.aspose.cells.pM.a(Unknown Source)
     at com.aspose.cells.pM.a(Unknown Source)
     at com.aspose.cells.Worksheet.autoFitRow(Unknown Source)
     at com.aspose.cells.kM.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.r(Unknown Source)
     at com.aspose.cells.WorksheetCollection.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.b(Unknown Source)
     at com.aspose.cells.WorksheetCollection.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.a(Unknown Source)
     at com.aspose.cells.Workbook.a(Unknown Source)
     at com.aspose.cells.Workbook.save(Unknown Source)
     at com.aspose.cells.Workbook.save(Unknown Source)
     at xxCells.Sav(xxCells:17)

    Any thoughts?

    Java 1.4.2

    Regards


    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
  •  11-09-2011, 11:33 PM 341193 in reply to 341188

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    Hi,

    Please set the correct font path at the begin of your program, such as code like following:

    CellsHelper.setFontDir("c:\\windows\\fonts"); //for common windows os

    Thank you.


    Johnson Shi
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  11-09-2011, 11:53 PM 341196 in reply to 341193

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    thanks for a quick reply. I put Fonts as you said and now it's giving me this:

    java.lang.NullPointerException
     at com.aspose.cells.b.a.b.g.<init>(Unknown Source)
     at com.aspose.cells.b.a.b.g.<init>(Unknown Source)
     at com.aspose.cells.pM.a(Unknown Source)
     at com.aspose.cells.pM.a(Unknown Source)
     at com.aspose.cells.pM.a(Unknown Source)
     at com.aspose.cells.Worksheet.autoFitRow(Unknown Source)
     at com.aspose.cells.kM.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.r(Unknown Source)
     at com.aspose.cells.WorksheetCollection.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.b(Unknown Source)
     at com.aspose.cells.WorksheetCollection.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.a(Unknown Source)
     at com.aspose.cells.Workbook.a(Unknown Source)
     at com.aspose.cells.Workbook.save(Unknown Source)
     at com.aspose.cells.Workbook.save(Unknown Source)
     at xxCells.Sav1(xxCells:36)


    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
  •  11-10-2011, 12:07 AM 341199 in reply to 341196

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    Hi,

    Thank you for your feedback. Which version of aspose.cells for Java are you using now? Would you please try the latest version V7.0.2.5? In recent fixes we have made some enhancements for doing with fonts, including enhancement for such kind of NullPointerException. If you still get this exception with the new fix, please give us more details about your OS, JDK and font settings so we can make further investigation.

    Thank you.


    Johnson Shi
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  11-10-2011, 5:33 PM 341455 in reply to 341199

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    ok I installed 7.0.2.5 it doesn't help but the stack changed:

    java.lang.NullPointerException
     at com.aspose.cells.b.a.b.g.<init>(Unknown Source)
     at com.aspose.cells.b.a.b.g.<init>(Unknown Source)
     at com.aspose.cells.vI.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.aa(Unknown Source)
     at com.aspose.cells.WorksheetCollection.<init>(Unknown Source)
     at com.aspose.cells.Workbook.<init>(Unknown Source)
     at xxCells.Sav1(xxCells:24)

     


    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
  •  11-10-2011, 11:26 PM 341499 in reply to 341455

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    and another question: how can I get formula cell updated? I need to put some number to a cell (PutValue()) and then read some value from a different cell in the same sheet with a formula inside. At the moment it's not updated and gives me just old saved value frmo a formula cell.
    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
  •  11-10-2011, 11:55 PM 341506 in reply to 341499

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    Hi,

    I think, you should call workbook.calculateFormula() and then read the results. This method will calculate the values of all the formulas and you will be able to get the correct value.

    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Sialkot Team
    Contact Us
    Aspose - The .NET and Java Component Publisher

    Keep in touch! We're on Twitter and Facebook
     
  •  11-13-2011, 5:22 PM 341815 in reply to 341506

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    mshakeel.faiz:
    Hi,

    I think, you should call workbook.calculateFormula() and then read the results. This method will calculate the values of all the formulas and you will be able to get the correct value.

    it gives me

    java.lang.NullPointerException
     at com.aspose.cells.b.a.b.g.<init>(Unknown Source)
     at com.aspose.cells.b.a.b.g.<init>(Unknown Source)
     at com.aspose.cells.vI.a(Unknown Source)
     at com.aspose.cells.WorksheetCollection.aa(Unknown Source)
     at com.aspose.cells.WorksheetCollection.<init>(Unknown Source)
     at com.aspose.cells.Workbook.<init>(Unknown Source)
     at xxCells.Sav1(xxCells:25)


    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
    Filed under: aspose.cells
     
  •  11-13-2011, 5:40 PM 341816 in reply to 341199

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    join:

    Hi,

    Thank you for your feedback. Which version of aspose.cells for Java are you using now? Would you please try the latest version V7.0.2.5? In recent fixes we have made some enhancements for doing with fonts, including enhancement for such kind of NullPointerException. If you still get this exception with the new fix, please give us more details about your OS, JDK and font settings so we can make further investigation.

    Thank you.

    is this jar for java 1.4?


    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
  •  11-13-2011, 6:20 PM 341817 in reply to 341816

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    Attachment: Present (inaccessible)

    here are  jars I loaded to make it work(probably it'll give you an idea):

    jsr173_1.0_api.jar

    dom4j-1.6.1.jar

    stax2-api-3.1.1.jar

    woodstox-msv-rng-datatype-20020414.jar

    jaxb-libs-1.5.jar

    woodstox-msv-core-2.0.0.jar

    woodstox-msv-xsdlib-2.0.0.jar

    woodstox-core-asl-4.0.10.jar

    bcprov-jdk14-146.jar

    xercesImpl.jar

    aspose-cells-7.0.2.5.jar

     


    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
  •  11-14-2011, 1:04 AM 341851 in reply to 341817

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    Hi,

    After analyzing the issue, from the stack trace you provided, we think any simple template file can reproduce this exception at your end. But we cannot re-produce it here on our end. We will soon provide you a new version of the product. Hopefully, it will sort out your issue.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  11-14-2011, 4:27 PM 342120 in reply to 341851

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    I attached a file to the post above
    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
  •  11-14-2011, 5:12 PM 342122 in reply to 342120

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    Attachment: Present (inaccessible)
    Hi,

    I am unable to reproduce the exception using the following code. I used the latest version: Aspose.Cells for Java v7.0.2.6

    Please see the output xls file.

    Here is a list of jar files being used. These are specific to JDK 1.6.

    1. aspose-cells-7.0.2.6.jar
    2. bcprov-jdk16-146.jar
    3. dom4j-1.6.1.jar
    4. stax2-api-3.0.2.jar
    5. woodstox-core-asl-4.1.1.jar

    Java
    String path = "F:\\Shak-Data-RW\\Downloads\\test.xls";

    Workbook workbook = new Workbook(path);

    workbook.save(path + ".out.xls");


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Sialkot Team
    Contact Us
    Aspose - The .NET and Java Component Publisher

    Keep in touch! We're on Twitter and Facebook
     
  •  11-15-2011, 6:19 AM 342289 in reply to 342122

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    Hi,


    Such kind of issue are normally caused by the incorrect font path, so please make sure the font path you set was the correct one that contains the font files for all fonts used in your Excel file.

     

    We have checked the possible code that may cause such kind of Exception and made some improvements for doing with Font. Please try the new version(V7.0.3):

    http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry342254.aspx

    to see whether the exception has been fixed. If not, we are afraid we have to provide some debug versions to trace this issue at your end.

     


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  11-16-2011, 12:22 AM 342500 in reply to 342289

    Re: java.lang.IllegalArgumentException: Cannot find required font defination

    I installed cells.7.0.3 and calculateFormula started to work, thanks!

    But now I encountered another problem. If I put this code:

    CellsHelper.setFontDir("/tmp/Aspose/fonts");

    it's ending up with weird oracle message No more data to read from socket.

    If I comment that string, CalculateFormula works fine, but Save operation causes Cannot find required font defination[Family:Arial, Style:1]

    again.

    Any thoughts? Maybe I should change that string leading to Fonts folder? what is usually supposed to be in that folder? I just copied Fonts from c/:windows to the linux server

     

    Cheers


    Aspose.Cells 7.2.0 for Java
    Last Aspose.Words for Java
    Oracle 10.2.0.3.0
    java version "1.4.2"
    Red Hat 3.4.6-11
     
Page 1 of 2 (19 items)   1 2 Next >
View as RSS news feed in XML