響應文件開啟後的事件,設定excel調整列寬行高即可達到自動設定的效果C#中在後臺加入如下程式碼;PageOfficeCtrl1.JsFunction_AfterDocumentOpened = "adjustCell()"; Java中新增程式碼如下:PageOfficeCtrl poCtrl1 = new PageOfficeCtrl(request);poCtrl1.setJsFunction_AfterDocumentOpened("adjustCell()");在html中新增javascript函式function adjustCell(){ var app = document.getElementById("PageOfficeCtrl控制元件id").Document.Application; app.ActiveSheet.UsedRange.Select(); app.Selection.EntireRow.AutoFit(); app.Selection.EntireColumn.AutoFit();}
響應文件開啟後的事件,設定excel調整列寬行高即可達到自動設定的效果C#中在後臺加入如下程式碼;PageOfficeCtrl1.JsFunction_AfterDocumentOpened = "adjustCell()"; Java中新增程式碼如下:PageOfficeCtrl poCtrl1 = new PageOfficeCtrl(request);poCtrl1.setJsFunction_AfterDocumentOpened("adjustCell()");在html中新增javascript函式function adjustCell(){ var app = document.getElementById("PageOfficeCtrl控制元件id").Document.Application; app.ActiveSheet.UsedRange.Select(); app.Selection.EntireRow.AutoFit(); app.Selection.EntireColumn.AutoFit();}