lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


在 2019/2/28 19:11, Geoff Smith 写道:
> Hello
> 
> I am writing a script that uses Luacom to create an Excel spreadsheet.
> 
> I am stuck on an annoying problem. I want to write a comment to a cell. I can get the comment red triangle to appear in my spreadsheet and I can set the name of the author, but the comment text body that I am trying to set is always missing.
> 
> sheet.Cells(1, 10).AddComment("Test", "anAuthor")
> sheet:Range("E5").AddComment("Test", "anAuthor")
> 
> Both of these lines work in they dont generate an error and both show the author string but both do not show "Test" in the spreadsheet
> 
> Is this a luacom bug or am I doing something wrong here ?  Any help from a luacom expert would be appreciated, thanks
> 
> Geoff
> 
> 

neither an expert on luacom nor on excel, but I suppose you
should call ``AddComment`` with a colon instead of a dot.

also, the ``Cells`` method probably should also be called using colon.

try these lines, see if they worked:

```
sheet:Cells(1, 10):AddComment("Test", "anAuthor")
sheet:Range("E5"):AddComment("Test", "anAuthor")
```