UiPath - issue - "Append Text: Archive file cannot be size 0." (UiPath.Word.Activities v1.3.0)

【问题描述】

用 UiPath (2019.3.0 Community Edition) 编写了一个Tool,用 While 循环把整数从 10 ,每次循环+1,一直加到100,并利用 Append Text (UiPath.Word.Activities.DocumentAppendText) 把每次的值存入到Word文件中,但是在保存到 Word 时 Append Text 报错,下图是 Designer panel 的 workflow 和 异常截图

 

 以下是详细的报错信息:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.IO.FileFormatException: Archive file cannot be size 0.
   at UiPath.Word.FileDocument..ctor(String documentPath, Boolean createNew)
   at UiPath.Word.Activities.DocumentActivity.BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
   at System.Activities.AsyncCodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

 

 问题关键点:

Append Text: Archive file cannot be size 0.

 


【解决方法】

 原因:

程序中调用的Word文件是新建的,没有被打开过,也没有被编辑过

 

操作:

把调用的 Word 文件打开,随意写点字再删掉,然后保存,再次运行就不报错了

 

posted @ 2019-04-05 19:13  coco1989  阅读(758)  评论(0编辑  收藏  举报