Hello,
Hi,
Thanks for using Aspose.Cells for Java.
It seems you are using PHP, I have attached the PHP file that contains all the overloads and wrapper classes for your help.
You will have to look into them and write your PHP code that makes use of Aspose.Cells for Java using its wrapper classes.
Since you are using the LoadOptions Workbook constructor, so the following lines of wrapper functions/classes are relevant for you.
/*
create new wrapped class [Workbook] for java version [com.aspose.cells.Workbook]
WARNNING
the parameter[oInputStream0] maybe has no Php-wrapper.
@param oInputStream0 corresponding java type is {java.io.InputStream}
@param oLoadOptions1 com.aspose.cells.LoadOptions
/
static function create4Workbook($oInputStream0, $oLoadOptions1)
{
$workbook = new Java(‘com.aspose.cells.Workbook’, ClassFactory::_t1($oInputStream0), ClassFactory::_t1($oLoadOptions1));
return new Workbook($workbook);
}
/
create new wrapped class [Workbook] for java version [com.aspose.cells.Workbook]
@param oString0 String
@param oLoadOptions1 com.aspose.cells.LoadOptions
*/
static function create5Workbook($oString0, $oLoadOptions1)
{
$workbook = new Java(‘com.aspose.cells.Workbook’, $oString0, ClassFactory::_t1($oLoadOptions1));
return new Workbook($workbook);
}
Please also see the following Java code that converts csv file into xls for your help, which you can convert into PHP.
Java
String filePath = “F:\Shak-Data-RW\Downloads\source.csv”;
//LoadOptions for CSV format
LoadOptions opts = new LoadOptions(LoadFormat.CSV);
//Create a workbook from CSV file
Workbook workbook = new Workbook(filePath, opts);
//Save the CSV file into Xls format
workbook.save(filePath + “.out.xls”, SaveFormat.EXCEL_97_TO_2003);
Hello,
Hi,
Please make sure you are using our recent fix i.e Aspose.Cells for Java 7.3.3 with the attached php wrapper to execute your code. We used a simple php file to test your situation and found no failure.
The csv file can be read fine. Our php code is like following:
PHP
require_once("java/Java.inc");
require("AsposeCells.php");
$workbook = ClassFactory::create3Workbook("d:/temp/t.csv");
$cell = $workbook->getWorksheets()->getI(0)->getCells()->getII(0, 0);
echo $cell->getValue();
echo "exec over.";
?>
Hello,
Hi,
Hi,
If you are using the Java, then I have already provided the code. The code works fine with Eclipse.
I am not sure about your System Environment and how to execute the above code.
Aspose.Cells for Java is just a JAR file, if you can execute other JAR files, then you can also execute Aspose.Cells for Java code give in the above post.
You should search on internet how to execute any JAR code in your Environment.
Please also note, Aspose.Cells for Java also needs some other prerequisite libraries. You should add these libraries in your class path.
- bcprov-jdk16-146.jar
- dom4j-1.6.1.jar
- stax2-api-3.0.2.jar
- woodstox-core-asl-4.1.1.jar
Also, provide us your screenshot of error, it could also help us look into your issue further.