ClosedXML是否具有可用于将Excel文件另存为PDF的功能?
目前我正在使用ClosedXML来创建和填充excel文件,然后使用Interop保存为PDF.
但由于Interop依赖于syatem上安装的MS Office,因此每个版本的MS Office都会格式化.而且由于ClosedXML不需要安装MS Office,因此无需使用Interop即可直接从中导出或保存为PDF.
我有一个项目控件,我向其传递可观察的对象集合并将元素显示为按钮。我正在使用 DelegateCommands 捕获视图模型中的按钮单击。
我想知道如何知道单击了哪个按钮。我希望能够将与按钮关联的对象传递给我的虚拟机。
我的xaml:
<ItemsControl x:Name="list" ItemsSource="{Binding ChemList}"> //ChemList is observable collection of objects
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Margin="5"
Command="{Binding ElementName=list,Path=DataContext.OnBtnSelect}"
CommandParameter="{Binding}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding name}"/>
<TextBlock Text=" "/>
<TextBlock Text="{Binding num}"/>
</StackPanel>
</Button.Content>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
我的视图模型:
public DelegateCommand OnBtnSelect { get; private set; }
In the constructor:
OnBtnSelect = new DelegateCommand(OnSelect);
public void OnSelect()
{
//How do i get here the object associated with the clicked button?
}
Run Code Online (Sandbox Code Playgroud) 我的 SQL 存储过程中有 3 个变量,并且仅当第 3 个变量不为空时才添加连接。
这就是我尝试这样做的方式,但它不起作用。它在指出的行上给出了以下错误:
'{' 附近的语法不正确
ALTER PROCEDURE [dbo].[Search]
@one NVARCHAR(50), @two NVARCHAR(50), @three NVARCHAR(50)
SELECT cinfo.ID,
cinfo.Nam,
cinfo.INAM,
cinfo.CA,
cinfo.Form,
cinfo.Std,
cval.Prop,
cval.Cons,
sc.Accep
From dbo.Info AS cinfo
Inner JOIN dbo.values AS cval
ON cinfo.ID = cval.ID
INNER JOIN dbo.Sources AS sc
ON (cval.sID = sc.sID AND sc.Accept = 'A')
IF @three IS NOT NULL{ **<---------------------**
LEFT JOIN dbo.Synonym AS synm
ON cinfo.ID = synm.ID}
where (cinfo.NAM LIKE '%'+@one+'%' OR cinfo.CAS LIKE '%'+@two+'%' OR
synm.SynonymID …Run Code Online (Sandbox Code Playgroud)