CSV ファイルから OpenOffice スプレッドシートにデータを入力しています。
このコードは、スプレッドシートで新しいシートを取得します。
Public Spreadsheet getSpreadsheet(int sheetIndex, XComponent xComp)
{
XSpreadsheet xSheets = ((XSpreadsheetDocument)xComp).getSheets();
XIndexAccess xSheetIA = (XIndexAccess)xSheets;
XSpreadsheet XSheet = (XSpreadsheet)xSheetsA.getByIndex(sheetIndex).Value;
return XSheet;
}
次に、一度に 1 セルずつセル範囲にリストを入力するメソッドがあります。これらのセルの列サイズを自動的に設定できるようにしたいと考えています。これは次のようなものです
string final DataCell;
Xspreadsheet newSheet = getSpreadsheet(sheetIndex, xComp);
int numberOfRecords = ( int numberOfColumns * int numberOfRows);
for(cellNumber = 0; cellNumber < numberOfrecords; cellNumber++)
{
XCell tableData = newSheet.getCellbyPosition(columnValue, rowValue);
((XText)tableData).setString(finalDataCell);
column Value++;
if(columnValue > = numberOfColumns)
{
rowVal++ column = 0;
}
}
グーグルの後、私は関数を見つけました:
columns.OptimalWidth = True
http://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=31292で
しかし、これを使用する方法がわかりません。誰かがこれをさらに説明したり、セルを自動調整する別の方法を考えたりできますか?