开发者

Empty excel cell using java "getNamedRange("SOME_VARIABLE")"

I am project i have t开发者_StackOverflow中文版o modify the excel file using java codings. My requirement is to empty the cell completely which has the string value "SOME_VARIABLE".

book.getNamedRange("SOME_VARIABLE").remove();

Is the above code a right one. I tried with this but it is not working. So I tried to write a code to check Am I deleting it in a right WORKBOOK, like if the workbook does not contain "SOME_VARIABLE" then it should inform me . That code is as follows:

if(book.getNamedRange("SOME_VARIABLE")== null)
            {record("the"+SOME_VARIABLE+" is not found");}
            else{
            book.getNamedRange("SOME_VARIABLE").remove();}

Am I going in a right path ? As i am new to handle this excelEngine I am strugling. Kindly help me friends.


The code you provided will delete the cells of the Named Range (ref) SOME_VARIABLE.

If you want to check the value of the cell, you need to find (ref) the cells that contains SOME_VARIABLE.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜