小编Pra*_*aba的帖子

在Windows 10通用应用程序中尝试使用DllImport加载DLL时出错

我正在创建Windows应用程序.这是针对Windows 10平台,它是通用Windows应用程序,我使用https://github.com/phatware/WritePadSDK在Windows应用程序中创建写作伙伴.现在我所做的是在我从github下载的解决方案中,我添加了一个针对windows通用应用程序的项目.我已经添加了运行项目所需的所有必需的引用,但每次运行Windows 10通用项目时我都会收到错误无法加载DLL'WinRT_CPPLayer.dll':找不到指定的模块.(来自HRESULT的异常:0x8007007E).

请帮忙

谢谢.

windows dll dllimport windows-10-universal

9
推荐指数
0
解决办法
350
查看次数

仅使用showdown.js Markdown表达式库仅限制某些格式

我正在使用showdown.js,可以从https://github.com/showdownjs/showdown/下载

问题是我试图只允许某些格式?例如,只允许使用粗体格式,其余的不进行转换,例如丢弃格式

如果我正在编写下面是Markdown Expression的文本

"Text attributes _italic_, *italic*, __bold__, **bold**, `monospace`."
Run Code Online (Sandbox Code Playgroud)

以上的输出将在下面

<p>Text attributes <em>italic</em>, <em>italic</em>, <strong>bold</strong>, <strong>bold</strong>, <code>monospace</code>.
Run Code Online (Sandbox Code Playgroud)

转换后.现在我想要的是转换时,它应该将粗体表达式转换为它应该丢弃的其余表达式.

我使用下面的代码将markdown表达式转换为下面的普通文本

var converter = new showdown.Converter(),
//Converting the response received in to html format 
html = converter.makeHtml("Text attributes _italic_, *italic*, __bold__, **bold**, `monospace`.");
Run Code Online (Sandbox Code Playgroud)

谢谢!

html javascript markdown showdown

6
推荐指数
1
解决办法
461
查看次数

如何使用office.js找到Office AddIn Host它是Word应用程序还是Excel?

我正在创建一个办公室AddIn,它可以在excel和word应用程序中工作,如果它是一个单词或excel主机我想要执行不同的逻辑.我正在使用office.js创建办公室Addin.

例如 :-

let say type="Excel" // after some logic executed 

if(type=="Excel")
 {
//run code for excel applications 
}
else
{
//run code for word applications
}
Run Code Online (Sandbox Code Playgroud)

我试过用下面的声音: -

 if (Office.context.requirements.isSetSupported('ExcelApi', '1.1')) {
            alert("yes it is excel");
        }
Run Code Online (Sandbox Code Playgroud)

但是当我在excel中运行它时,它无法正常工作.

我也在清单文件中发送了主机

 <Hosts>
     <Host Name="Document" />
    <Host Name="Workbook" />
  </Hosts>
Run Code Online (Sandbox Code Playgroud)

还有一些代码改变做了很多谷歌搜索我找到了波纹管代码,这对我不起作用

function getHostInfo() {
    var _requirements = Office.context.requirements;
    var types = ['Excel', 'Word'];
    var minVersions = ['1.1', '1.0']; // Start with the highest version

    // Loop through types and minVersions
    for (var …
Run Code Online (Sandbox Code Playgroud)

excel add-in office-js

6
推荐指数
1
解决办法
780
查看次数

如何使用 Office.js 获取单元格的格式

我正在开发一个 Excel 插件,它提取单元格 A1 的文本,包括其格式并在其自己的区域中显示文本。所以插件包含这个(见下面的截图): • 显示格式化文本的区域 • 开始提取的按钮 请点击查看图片

波纹管是我用来获取文本的代码

function displaySelectedCells() {
    Office.context.document.getSelectedDataAsync(Office.CoercionType.Text,
        function (result) {
            if (result.status === Office.AsyncResultStatus.Succeeded) {
                showNotification('The selected text is:', '"' + result.value + '"');
            } else {
                showNotification('Error', result.error.message);
            }
        });
}
Run Code Online (Sandbox Code Playgroud)

上面的代码使用 "CoercionType" 作为 "Text" 。我已经尝试了很多来找到解决方案来获取以表格单元格格式写入的文本。我得到的响应只是平面文本:( 请帮我解决问题

javascript excel office-js

5
推荐指数
1
解决办法
1866
查看次数

我如何访问Word或Excel中添加的表,并使用Office.js迭代每个行和单元格

在文档或工作表中添加表行和列后,是否可以迭代它们.

我正在使用以下代码添加一个表,我希望这个代码成功我应该能够访问行和列应该能够在一些转换后替换单元格的值.Bellow是我用来创建表的代码.

     var tableData = new Office.TableData();
            var headers = [placeholder.columns.map(function (c) { return c.column; })];
            tableData.headers = headers
            tableData.rows = rows;
            var document = Office.context.document;

            document.setSelectedDataAsync(tableData, function (result) {
                var placeholder = Office.context.document.settings.get(results.binding.id);
                    if (officeCallSucceded(result, true)) {
                        document.bindings.addFromSelectionAsync(Office.BindingType.Table, function (result) {
                            if (officeCallSucceded(result)) {
                               //SOME  LOGIC FOR BINDING HERE TO ADD //EVENT handlers to the table just added
                            }
                        });
                    }
                }
                );
            }
Run Code Online (Sandbox Code Playgroud)

javascript add-in office-app office-js

5
推荐指数
1
解决办法
480
查看次数

在Canvas Windows 10 Universal Apps上绘制形状时出错

我正在创建一个在画布上绘制形状的应用程序,并使用https://github.com/phatware/WritePadSDK sdk将这些形状识别为字母用于书写板.但问题是这个api代码在Windows 8.1项目中使用时工作正常但是当在Windows 10通用应用程序中使用相同的代码时,它会在我调试代码时产生错误.下面给出了xaml代码

     <Canvas   Background="WhiteSmoke" Name="InkCanvas" PointerPressed="OnCanvasPointerPressed"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" PointerReleased="OnCanvasPointerReleased" PointerCaptureLost="OnCanvasPointerCaptureLost" PointerExited="InkCanvas_OnPointerExited" PointerMoved="OnCanvasPointerMoved" LostFocus="InkCanvas_LostFocus">
Run Code Online (Sandbox Code Playgroud)

并且在下面给出了使用sdk识别形状的代码,该代码在Canvas的PointerReleased事件上执行: -

 var resultValue = recognizerShared.RecognizeStrokes(InkCanvas.Children.ToList(), false);
Run Code Online (Sandbox Code Playgroud)

当我检查sdk中给出的方法即RecognizeStrokes进行重新定位时,我在调试时遇到错误

在此输入图像描述

由于此代码在Windows 8.1项目中正常工作,我认为它可能是Windows 10通用应用程序问题的东西

下面给出了Excelption的详细信息: -

AccessKey = 'new System.Collections.Generic.Mscorlib_CollectionDebugView<Windows.UI.Xaml.UIElement>(strokes).Items[0].AccessKey' threw an exception of type 'System.InvalidCastException'
Run Code Online (Sandbox Code Playgroud)

AccessKeyScopeOwner ='new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .AccessKeyScopeOwner'抛出类型'System.InvalidCastException'的异常

AllowFocusOnInteraction ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).AllowFocusOnInteraction'抛出类型'System.InvalidCastException'的异常

AllowFocusWhenDisabled ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).AllowFocusWhenDisabled'抛出类型'System.InvalidCastException'的异常

ContextFlyout ='new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .ContextFlyout'抛出类型'System.InvalidCastException'的异常

ExitDisplayModeOnAccessKeyInvoked ='new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .ExitDisplayModeOnAccessKeyInvoked'抛出类型'System.InvalidCastException'的异常

FocusVisualMargin ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).FocusVisualMargin'抛出了类型'System.InvalidCastException'的异常

FocusVisualPrimaryBrush ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).FocusVisualPrimaryBrush'抛出类型'System.InvalidCastException'的异常

new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .IsAccessKeyScope

请帮我解决上面的问题.

下载示例项目代码的链接如下所示,用于测试可以看到问题的位置

https://www.dropbox.com/s/1xbtxbxwyoyuf00/WindowsSDK.rar?dl=0

谢谢!

c# xaml uwp windows-8.1-universal

5
推荐指数
0
解决办法
258
查看次数