我想知道如何避免使用Windows剪贴板,当你想"复制"Word文档的多个部分时(在宏中使用VBA)
为什么要避免?因为我们在服务器上使用Word,在多用户环境中(我知道它是正式的不赞成)
否则,使用Selection.Copy和Selection.Paste方法可以轻松完成.
谢谢.
对于一个愚蠢的问题感到抱歉,但我无法完全理解会发生什么,如果这是我怀疑的问题,那么我真的很茫然。我正在使用弹簧靴+百里香叶+物化CSS来显示和验证表单。现在我在很多例子中没有遇到的是这种情况:
一些表单字段是预先填写的,对客户端来说应该被禁用,显示其预先填写的值。这种预填充发生在控制器中,而我处理其他一些请求,并重定向到该视图
我正在使用th:object这样将pojo绑定到表单
<form id="register_form" action="#" th:action="@{/showform}" th:object="${userInfo}" method="post">
<div class="input-field">
<label th:text="#{label.surname}" for="surname"></label>
<input type="text" th:field="*{surname}" id="surname" th:attr="value=${userInfo.surname}" />
</div>
<div class="input-field">
<label th:text="#{label.name}" for="givenname"></label>
<input type="text" th:field="*{givenname}" id="givenname" th:attr="value=${userInfo.givenname}" disabled="disabled" />
</div></form>
Run Code Online (Sandbox Code Playgroud)
并将其放入控制器的POST处理程序中,如下所示:
@RequestMapping(value = {"/showform"}, method = RequestMethod.POST)
public ModelAndView submitFormPage(@ModelAttribute("userInfo") @Valid UserInfo userInfo,
BindingResult bindingResult, RedirectAttributes redir)
{
ModelAndView mview = new ModelAndView();
if (bindingResult.hasErrors())
{
// show form again with error messages
mview.addObject("userInfo", userInfo);
mview.setViewName("/showform");
}
else
{
// ...
}
return mview;
}
Run Code Online (Sandbox Code Playgroud)
出于其他一些原因,存在RedirectAttributes。如您所见,表单上有两个元素,第一个被启用,第二个被禁用。它们的值已正确填入POJO中的预填充值,然后通过ModelMap传递到视图。我也可以在GET处理程序中跟踪它。 …