使用VSTO,我在功能区设计器中创建了一个自定义选项卡,并在那里添加了一些组和按钮控件.当用户单击其中一个按钮时,我想连接到SharePoint站点并在Word中打开Word文档(实例已打开).我已经能够连接到SharePoint站点并拥有我想要打开的文档的URL.
但是我怎样才能将这些文档加载到Word中?我已经在Word中的代码隐藏中,所以如何定位我所在的Word实例并在那里打开文件?
提前致谢.
我有这样定义的全局错误处理程序(清除了简化/专有信息):
export class ErrorsHandler extends CommonBase implements ErrorHandler {
constructor(protected loggingService: LoggingService,
private coreService: CoreService {
super(loggingService);
}
handleError(error: Error) {
if (error && error.stack && (error.stack.indexOf(Constants.PACKAGE_NAME) >= 0)) {
this.logSystemError(error, true);
this.coreService.showSystemError(error, this.owner);
}
else {
// Rethrow all other errors.
throw error;
}
}
Run Code Online (Sandbox Code Playgroud)
并且在我的模块(并且只有我的模块)中,它被注册为提供者,如下所示:
export function errorHandlerFactory(loggingService: LoggingService, coreService: CoreService) {
return new ErrorsHandler(loggingService, coreService);
}
providers: [
{ provide: ErrorHandler, useFactory: errorHandlerFactory, deps: [LoggingService, CoreService] }
]
Run Code Online (Sandbox Code Playgroud)
我的模块被其他人使用,我们一起组成了一个大型应用程序。我的问题是,即使我尝试过滤仅与我的模块/软件包相关的那些脚本,也会捕获到所有脚本错误,因为过滤是在中完成的handleError()。即使我重新抛出了与我无关的错误(在else上面),其他模块/程序包的开发人员仍在抱怨我在全球范围内捕获所有内容,并且重新抛出的错误已经失去了某些上下文/信息。
所以问题是,是否有可能以某种方式限制我的错误处理程序的范围,以仅捕获和处理源自我的模块/包的脚本错误(而完全忽略应用程序中的所有其他脚本错误)?
经过大量的搜寻之后,我唯一想到的替代方法是将try/catch其放置在任何地方,这是我想尽可能避免的方法。
error-handling typescript angular angular-errorhandler angular7
我目前有以下逻辑构建一个包含4个整数的列表,其中每个整数代表某个项目ID(1,2,3或4)的所有投票的总和:
List<int> totals = new List<int>();
using (RepositoryEntities entityContext = new RepositoryEntities())
{
totals.Add(entityContext.ItemVotes.Count(v => v.Vote == 1));
totals.Add(entityContext.ItemVotes.Count(v => v.Vote == 2));
totals.Add(entityContext.ItemVotes.Count(v => v.Vote == 3));
totals.Add(entityContext.ItemVotes.Count(v => v.Vote == 4));
}
Run Code Online (Sandbox Code Playgroud)
这非常有效,但我质疑这种查询的效率,因为这似乎实际上生成并执行了4个单独的查询.理想情况下,我想要一个有效的查询,返回4个总和.
有任何想法吗?
提前致谢.
我试图通过从ImageView转换为TouchImageView来改变我的图像查看器活动,根据这里的答案:如何获得图像的缩放功能?
但是,当我的活动尝试加载时出现错误:
二进制XML文件行#15:错误膨胀类TouchImageView
这是我的image_viewer.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!--
<WebView
android:id="@+id/webView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
-->
<TouchImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我的代码在ImageViewer.java的 onCreate里面(虽然我很确定执行从来没有这么做):
if(filepath != null && filepath.length() > 0 && new File(filepath).exists())
{
Bitmap myBitmap = BitmapFactory.decodeFile(filepath);
TouchImageView imgView = (TouchImageView) findViewById(R.id.imageView1);
imgView.setImageBitmap(myBitmap);
}
Run Code Online (Sandbox Code Playgroud)
有关导致此错误的原因或原因的任何想法?我所看到的是最内部的例外/原因.不知道如何获得有关错误的更多详细信息.
提前致谢.
更新:
执行此行时会抛出异常:
setContentView(R.layout.image_viewer);
Run Code Online (Sandbox Code Playgroud)
有关错误的更多详细信息:
java.lang.ClassNotFoundException:loader中的android.view.TouchImageView dalvik.system.PathClassLoader@44bfde70
我需要在页面/用户控件上为其他开发人员留下一些教学评论.除了以下之外,还有更好的方法吗?
<% /* DO NOT rename control IDs here, because blah blah blah... */ %>
Run Code Online (Sandbox Code Playgroud) 我确定这是非常愚蠢的事情,但我只是看不到它..
pData.LocationHours是类型的BaseLocationHoursDataSet.LocationHoursDataTable.然而,当我将光标悬停在上面时l,我看到的只是" (range variable) TSource l" - 为什么会这样?linq为什么不知道它正在处理什么?我用不同的DataTable尝试相同的东西,一切正常....不是这个人.可能是什么问题呢?
protected ListItem[] GetHoursTypesListItems(BaseLocationHoursDataSet pData)
{
return (
from l in pData.LocationHours // putting cursor over the l here shows: (range variable) TSource l
select new ListItem
{
Value = l, //ignore the fact that I didn't specify a property - that's the problem, that none of the properties of the object show up.
Text = l
}
).ToArray<ListItem>();
}
Run Code Online (Sandbox Code Playgroud)
.
更新:
问题是它不知道我是什么.而不是向我显示正确的类型(我希望看到LocationHoursRow),我看到"TSource l"..这是什么?为什么不知道我在" from l in …
我确定这是一件令人愚蠢的事情.任何人都可以看看这个页面并告诉我为什么BYOB部分出现在右边而不是美国部分下面?
提前致谢.