0

私はクライアント側のhtaアプリケーションを設計している最中です(javascriptのみを使用)。Scripting.FileSystemObject "を使用して最初からxlsファイルを作成できるようにしたいのですが。基本的に、出力はファイルに書き込まれ、.xls形式で保存されます。

これをどのように行うか、ActiveX.Object( "Excel.Application)から離れたいと思います。htaアプリケーションがユーザーのコンピューターに依存することを望まないためです。

よろしくお願いします。

乾杯、

ジェイ

4

1 に答える 1

1

Maybe not the answer you're looking for, but when dealing with Excel files, it's worth noting that there is usually only one true shortcut: if you mean simply a table of values, you really mean a .CSV file.

Excel will gladly open a CSV file, or a resource in CSV format with a mime type appropriate for Excel. Usually, if Office/Excel is installed on the machine, then the file association will be in place. Of course, you cannot embed any formatting, just values, although maybe someone knows how to associate some kind of excel style information when opening the file (I don't).

Now, generating CSV output is straightforward, and you just have to watch for encoding of commas (which is widely referred to, and google-able as, "csv encoding" for lack of better term).

Of course, there are a large number of Excel/Office (scriptable) libraries, a lot of them being commercial in nature. You're probably looking at more work and more coupling (i.e. a solution more dependent on your library).

于 2012-09-08T22:39:25.697 に答える