Hi,
I think you may make use of Aspose.Cells APIs and some java.io
classes to accomplish your task for your requirements. Please refer to the following sample code for your reference. The code is in .NET, so you may easily convert it to JAVA for your needs:
e.g.
Sample code:
…
static void TestFile()
{
string filePath = @“E:\Test\Files\test\aa”;
Workbook wb = new Workbook(filePath + “a.xlsx”);
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.Html);
saveOptions.IsFullPathLink = true;
saveOptions.StreamProvider = new ExportStreamProvider(filePath);
wb.Save(filePath + “out.html”, saveOptions);
}
public class ExportStreamProvider : IStreamProvider
{
private string outputDir;
public ExportStreamProvider(string dir)
{
outputDir = dir;
}
public void InitStream(StreamProviderOptions options)
{
string path = outputDir + Path.GetFileName(options.DefaultPath);
string fileName = Path.GetFileName(path);
string dir = Path.GetDirectoryName(path);
if (fileName.StartsWith(“sheet”))
{
path = dir + @"\sheets" + fileName;
}
else if (fileName.Equals(“stylesheet.css”))
{
path = dir + @"\styles" + fileName;
}
else if (fileName.Equals(“filelist.xml”) || fileName.Equals(“tabstrip.htm”))
{
path = path;
}
else
{
path = dir + @"\images" + fileName;
}
options.CustomPath = path;
Directory.CreateDirectory(Path.GetDirectoryName(path));
options.Stream = File.Create(path);
}
public void CloseStream(StreamProviderOptions options)
{
if (options != null && options.Stream != null)
{
options.Stream.Close();
}
}
}
…
Let us know if you still have any issue.
Thank you.