Hi,
I am using XamDataGrid and DataPresenterExcelExporter which is exporting my fields to Excel fine except for my unbound field which is coming up with blank values. Can you please advise?
This is my code snippet:
<ipdg:Field BindingType="Unbound" Label="Cust All-In Price" Visibility="Collapsed"> <ipdg:Field.Settings> <ipdg:FieldSettings Width="Auto" CellValuePresenterStyle="{StaticResource BidAskCell}" AllowRecordFiltering="False" LabelClickAction="Nothing"/> </ipdg:Field.Settings> </ipdg:Field>
Thanks.
Hello,
Thank you for choosing Infragistics.
I have been looking into your issue and I have prepared a sample application for you to test. Please note that I was not able to reproduce the issue you have described.
Would you please provide me with more detailed information in regards to the setting of the Visibility property of the Field and the style you have used for the CellValuePresenter? Would you also please modify the sample application I have attached so the issue is reproduced and send it back to me? Having this information would help me further investigate this matter for you.
Looking forward to your reply.
Thank you for your reply. This is the BidAskCell style for the CellValuePresenter:
<Style x:Key="BidAskCell" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}" >
<StackPanel x:Name="stackPanel" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Name="BidRate" Foreground="{StaticResource ForegroundBrush}" Margin="0" Padding="0">
<TextBlock Text="{Binding Path=Record.DataItem.NearLegPriceInCuBid, RelativeSource={RelativeSource TemplatedParent}}"/>
</Label>
<TextBlock Name="Slash" Text=" / " VerticalAlignment="Center" Foreground="{StaticResource PriceMinorDigitsForeground}" />
<Label Name="AskRate" Foreground="{StaticResource ForegroundBrush}" Margin="0" Padding="0">
<TextBlock Text="{Binding Path=Record.DataItem.NearLegPriceInCuAsk, RelativeSource={RelativeSource TemplatedParent}}"/>
</StackPanel>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=DataItem.NearLegPriceInCuAsk}" Value="{x:Null}">
<Setter TargetName="Slash" Property="Visibility" Value="Collapsed"></Setter>
<Setter TargetName="AskRate" Property="Visibility" Value="Collapsed"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Path=DataItem.NearLegPriceInCuBid}" Value="{x:Null}">
<Setter TargetName="BidRate" Property="Visibility" Value="Collapsed"></Setter>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
This is the difference between the code you sent me and my code. I don't do the assignment in C#. On the C# side, I only have:
var exporter = (DataPresenterExcelExporter) Resources["Exporter"]; exporter.Export(TradeGrid, fileName, WorkbookFormat.Excel2007);
The visibility is initially set as Collapsed but then the user can go in the Field Chooser and select the column to be displayed. When I export to Excel, there is a column called "Cust All-In Price" but the values are all empty.
Let me know if you require more information.
Thank you.
Thank you for your feedback.
The behavior you have described is expected because the Excel itself recognizes the values with their editing type which is a string. In order to avoid the message produced by Excel you can always use the first approach and use explicitly defined numbers or change the type of the cells directly in Excel.
If you require any further assistance on this matter, please do not hesitate to ask.
Thanks. Do you have a CSV exporter by any chance?
Currently, the Workbook class does not support saving and loading to and from CSV files. For more information in regards to this behavior, you can take a look at the following thread:
http://es.infragistics.com/community/forums/t/104677.aspx
If you require any further assistance on the matter, please let me know.
Would be great to have a CSV Exporter in the future but for now the Excel Exporter will do. Thanks a lot for your help.
Thank you for your feedback. I am glad to know that I was able help you achieve the functionality you were looking for. I believe this thread can help other people looking for a similar solution.