我必须在Word文档中获取所有内容控件并插入信息,但运行该程序的PC不需要安装Word。
我试过:
List<SdtContentText> lista = parteDocumento.Document.Descendants<SdtContentText>().ToList();
foreach (SdtContentText objeto in lista)
Run Code Online (Sandbox Code Playgroud)
并将 SdtContentText 更改为 SdtBlock
编辑:
现在我可以获得 ContentControls 但我无法编辑它们的innerText
List <OpenXmlElement> lista = parteDocumento.Document.Body.ToList().FirstOrDefault<OpenXmlElement>().ToList();
foreach (var objeto in lista)
{
if (objeto != null && objeto is SdtRun)
{
SdtRun objeto2 = (SdtRun)objeto;
.....
Run Code Online (Sandbox Code Playgroud) 我正在尝试通过 ButtonRender 实现 android 按钮的功能。当我尝试加入“.LongClick”和“.touch”时会出现问题,因为它不会启动长按事件。
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
{
this.SetBackgroundResource(Resource.Drawable.button);
base.OnElementChanged(e);
Android.Widget.Button thisButton = Control as Android.Widget.Button;
thisButton.LongClickable = true;
thisButton.LongClick += delegate
{
string s = "";
};
thisButton.Touch += (object sender, Android.Views.View.TouchEventArgs e2) =>
{
if (e2.Event.Action == MotionEventActions.Down)
{
.
.
.
}
else if (e2.Event.Action == MotionEventActions.Up)
{
.
.
.
}
else if (e2.Event.Action == MotionEventActions.HoverExit || e2.Event.Action == MotionEventActions.Cancel)
{
.
.
.
}
else if (e2.Event.Action == MotionEventActions.Move)
{
.
. …Run Code Online (Sandbox Code Playgroud)