我遇到了Excel Interop的问题.
即使我重新发布实例,Excel.exe也不会关闭.
这是我的代码:
using xl = Microsoft.Office.Interop.Excel;
xl.Application excel = new xl.Application();
excel.Visible = true;
excel.ScreenUpdating = false;
if (wordFile.Contains(".csv") || wordFile.Contains(".xls"))
{
//typeExcel become a string of the document name
string typeExcel = wordFile.ToString();
xl.Workbook workbook = excel.Workbooks.Open(typeExcel,
oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing);
object outputFileName = null;
if (wordFile.Contains(".xls"))
{
outputFileName = wordFile.Replace(".xls", ".pdf");
}
else if (wordFile.Contains(".csv"))
{
outputFileName = wordFile.Replace(".csv", ".pdf");
}
workbook.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, outputFileName,
XlFixedFormatQuality.xlQualityStandard, oMissing,
oMissing, …
Run Code Online (Sandbox Code Playgroud) 我制作了一个 winform,其中包含一个 tabControl (3 个选项卡,也许以后会更多)。
在我的两个选项卡中,我有一个 listBoxView。
问题是,当我单击 fullSize 按钮时,tabControl 不会更改其大小。这就是一个可怕的窗户。
如何根据 winforms 边框大小定义 tabControl 的动态大小,以及基于 tabControl 大小的 listBoxView 的动态大小?
TabControl 必须适应表单大小,然后 tabControl 中的页面必须适应 tabControl 大小,然后,页面中的 listBox 必须适应其页面大小。
表格如下:
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1313, 614);
this.Controls.Add(this.tabControl1);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgCSV)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.ResumeLayout(false);
Run Code Online (Sandbox Code Playgroud)
以及 tabControl 及其页面之一:
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(13, 13);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1288, 589); …
Run Code Online (Sandbox Code Playgroud) 我搜索了很多但从未找到我想要的东西.
我想控制当前页面中是否存在xpath.
我发现用java/xml,php等...但不仅仅是java.
如果存在xpath,我会以一种简单的方式检查当前页面.
谢谢.
问候.
我正在尝试在我的自定义portlet的conf中添加一个选项卡,除了本机导入/导出和权限.
如下图所示:http://imageshack.us/photo/my-images/716/sampledn.png/
此选项卡必须允许更改定义某个变量的conf.properties中的参数值.
我怎样才能做到这一点?
问候.
我正在尝试设置portlet首选项,而不触及portlet.xml.
这是我的portlet:
-myportletclass
-myportletjsp
-myconclass
-myconfjsp
Run Code Online (Sandbox Code Playgroud)
当我点击偏好时,我可以看到confjsp,它会显示我喜欢的表单.并且,当我提交它时,将首选项设置为表单中的值.
但是我没有任何默认值,没有修改portlet.xml.
我应该添加什么?
我看到有些人在配置类的渲染中这样做,但它不起作用.
问候.谢谢.
编辑:我设置我的偏好的方式:
首先,我有一个简单的形式我的conf jsp,基本的,不需要添加它; 然后,我有ConfController:
@Controller
@RequestMapping("EDIT")
public class ConfigurationController {
@ModelAttribute("validatePref")
public ValidatePrefForm getValidatePrefForm() {
ValidatePrefForm form = new ValidatePrefForm();
return form;
}
@ActionMapping(params = "action=validatePref")
public void processAction(@ModelAttribute("validatePref") ValidatePrefForm form,
PortletPreferences portletPreferences, ActionResponse response)
throws Exception {
String mylink = form.getMylink();
if (null != mylink && !mylink .equals("")) {
portletPreferences.setValue("mylink ", mylink );
}
portletPreferences.store();
}
@RenderMapping
public String render() throws Exception {
return "myportletjsp.jsp";
}
}
Run Code Online (Sandbox Code Playgroud)
然后,在我的portlet中我得到了这个值: …
我正在浏览docx,使用open xml来查找一些图像.
所以,我这样做是为了得到所有的图纸,它有一个docProperties作为孩子,标题包含
List<Drawing> sdtElementDrawing = wordDoc.MainDocumentPart.Document.Descendants<Drawing>()
.Where(element =>
element.GetFirstChild<Drawing>() != null
&& element.GetFirstChild<DocProperties>().Title.Value.Contains("IMAGE")).ToList();
Run Code Online (Sandbox Code Playgroud)
而docx作为xml看起来在第一部分看起来很喜欢(它通常更大,但我只复制相关部分):
<w:drawing>
<wp:anchor distT="0" distB="0" distL="114300" distR="114300" simplePos="0" relativeHeight="251658240" behindDoc="1" locked="0" layoutInCell="1" allowOverlap="1" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
<wp:simplePos x="0" y="0" />
<wp:positionH relativeFrom="column">
<wp:posOffset>2171700</wp:posOffset>
</wp:positionH>
<wp:positionV relativeFrom="paragraph">
<wp:posOffset>-1168400</wp:posOffset>
</wp:positionV>
<wp:extent cx="2286000" cy="746760" />
<wp:effectExtent l="0" t="0" r="0" b="0" />
<wp:wrapNone />
<wp:docPr id="1" name="Image 1" descr="C:\Users\Pictures\IMAGERM.jpg" title="IMAGERM" />
</wp:anchor>
</w:drawing>
Run Code Online (Sandbox Code Playgroud)
但我没有找到sdtElementDrawing
.
所以我想我错误地写了这个sdtElementDrawing
查询.我必须错过一个明显的方式来告诉"得到绘图的孩子,哪里有一个像IMAGE这样的标题的DocProperties",但我找不到它.
我也试过这个,但效果不好:
List<Drawing> sdtElementDrawing = wordDoc.MainDocumentPart.Document.Descendants<Drawing>()
.Where(element =>
element.GetFirstChild<Drawing>() != null &&
element.GetFirstChild<Drawing>().Anchor.GetFirstChild<DocProperties>().Title.Value.Contains("IMAGE")).ToList();
Run Code Online (Sandbox Code Playgroud) 我想在验证表单时添加确认消息和重定向到我的jsp.
我在liferay的源代码中看到了这个
SessionMessages.add(actionRequest, config.getPortletName() + ".doConfigure");
Run Code Online (Sandbox Code Playgroud)
这会显示绿色样式的消息Param has been saved successfully
.但是不起作用.它显然使用配置菜单(打开一个弹出窗口),我使用首选项菜单,我仍然可以调整这行代码吗?
当我更改首选项时,我想在我的portlet中进行重定向,但是现在,它仍然在首选项页面上,我必须单击Return to full page
.
此外,如果未验证首选项,是否可以显示错误消息?
问候.谢谢
我有一个有效的winforms应用程序,并且发布得很好.
问题是,我进入发布文件夹的版本仍然在方案中:1.0.0.1
,而在AssemblyInfo.cs中,我得到了这个:
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.1.*")]
Run Code Online (Sandbox Code Playgroud)
我知道我必须改变自己的第一部分1.1
,当它来了,但我在想,这一点,我获得1.1.1
,1.1.2
而不是1.0.0.1
,1.0.0.2
.
我正在做CLickOnce发布.
如何选择多一点的版本号?
有人可以解释它是如何工作的吗?
谢谢.
我正在使用一些DataRow和它,一些ItemArray.
我知道如何将值传入ItemArray,但是当我创建一个新Row时,我不知道如何设置值.
所以我尝试了这个:
DataRow newRow = vDsMod.Tables[0].NewRow();
newRow.ItemArray[0] = "".ToArray();
newRow.ItemArray[1] = "".ToArray();
newRow.ItemArray[2] = "Employee".ToArray();
newRow.ItemArray[3] = "".ToArray();
vDsMod.Tables[0].Rows.Add(newRow);
Run Code Online (Sandbox Code Playgroud)
要么
DataRow newRow = vDsMod.Tables[0].NewRow();
newRow.ItemArray.SetValue("", 0);
newRow.ItemArray.SetValue("", 1);
newRow.ItemArray.SetValue("Employee", 2);
newRow.ItemArray.SetValue("", 3);
vDsMod.Tables[0].Rows.Add(newRow);
Run Code Online (Sandbox Code Playgroud)
但是我只在ItemArray中得到空字段.值0,1,3可以为空,并且由于其他行的ItemArray的长度为4,我还设置了4个值.
我怎么能做我想做的事?
我想将样式(字体大小)应用于所有文本框时遇到问题,无论它们在哪里。
我当然找到了这些链接: Apply an application-level style to all textboxes
但这对我不起作用。
第一个仍然更好,因为您不需要使用密钥,也不需要转到所有文本框。
我已经在我的 app.xml 中将样式应用于所有控件(应用颜色),所以我尝试了这样的事情(即使这对我来说还不够,因为这些样式并非无处不在):
<Style x:Key="Type1Data" TargetType="{x:Type Control}">
<Setter Property="Background" Value="#FEE9E6"/>
<Style.Resources>
<Style TargetType="{x:Type TextBox}">
<Setter Property="FontSize" Value="50" />
</Style>
</Style.Resources>
</Style>
Run Code Online (Sandbox Code Playgroud)
正如我所说,我也试过这个,但行不通。
<Style TargetType="{x:Type TextBox}">
<Setter Property="FontSize" Value="50" />
</Style>
Run Code Online (Sandbox Code Playgroud)
知道我的问题是什么以及如何实现我想要的目标吗?我能找到的所有铰链都让我回到相同的代码,但没有找到一个有效的。
编辑:这是我当前的 app.xaml
<Application x:Class="myApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:myApp"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style TargetType="TextBox"><!-- tried adding those 3 lines too-->
<Setter Property="FontSize" Value="50"/>
</Style>
<Style x:Key="Type1Data" TargetType="{x:Type Control}">
<Setter Property="Background" Value="Blue"/>
</Style>
<Style x:Key="Type2Data" TargetType="{x:Type Control}">
<Setter Property="Background" Value="White"/> …
Run Code Online (Sandbox Code Playgroud)