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

Free Support Forum - aspose.cloud

Aspose.Cells Cloud の API 経由で PutConvertWorkbook を用いて Excel を HTML に変換するとスタイルが崩れることがある

以下のようなコード(Kotlin)を用いて Aspose.Cells Cloud を用いて Excel を HTML に変換したいのですが、半分以上の確率でダウンロードした HTML のスタイルが崩れてしまいます。
上手く変換できている HTML と比較すると明らかにファイルサイズが異なり、HTMLの構造もBase64で埋め込んでいる画像も欠損しています。
こちらは、どのように対応したらよろしいでしょうか。

val excelFile = File(excelFilePath)
val htmlFileName = “export.html”
val request = PutConvertWorkbookRequest().apply {
checkExcelRestriction = false
format = “html”
file = hashMapOf(htmlFileName to excelFile)
}
val cellsApi = CellsApi(asposeClientId, asposeClientSecret)
cellsApi.putConvertWorkbook(request)

@sukechannnn,

Please try to add extended query parameters. And refer to the following code:

    request.extendQueryParameterMap = new  Dictionary<string, string>();
    request.extendQueryParameterMap.Add("SaveAsSingleFile","true");

@wangtao

Thank you for your reply, but the PutConvertWorkbookRequest class does not have a property named extendQueryParameterMap. I am using Aspose.Cells for Cloud Java SDK, available at https://github.com/aspose-cells-cloud/aspose-cells-cloud-java.

Is there an alternative solution?

@sukechannnn,

We will refer to Net SDK to provide you with a solution as soon as possible.

1 Like

@sukechannnn,

We had added a new feature about extend query parameters on the latest version.

Please refer to the following code or test case of Github :

String localName = “Book1.xlsx”;
String remoteName = “Book1.xlsx”;
String format = “html”;
String newfilename = “DotNetSDK/OutResult/PostExcelSaveAs.html”;
CellsApiUtil.Upload(api, remoteFolder + “/” + remoteName , localName , “”);
PostWorkbookSaveAsRequest request = new PostWorkbookSaveAsRequest();
request.setName(remoteName);
request.setNewfilename(newfilename);
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setSaveFormat(format);
request.setSaveOptions(saveOptions);
request.setFolder(remoteFolder);
HashMap<String, String> extendQueryParameterMap = new HashMap<>();
extendQueryParameterMap.put(“SaveAsSingleFile”, “true”);
extendQueryParameterMap.put(“ExportImagesAsBase64”, “true”);
request.setExtendQueryParameterMap(extendQueryParameterMap);
SaveResponse response = this.api.postWorkbookSaveAs(request);

Thank you!

I’ll try it.

@sukechannnn,
Welcome to Aspose.Cells Cloud SDK. Please let us know if you encounter any issues. We will check them as soon as possible.