Showing posts with label property. Show all posts
Showing posts with label property. Show all posts

Wednesday, March 7, 2012

Export To Excel, CSV, XML with expression in Hidden property omits data

I have a matrix table with a rectangle in the data cell. The rectangle has an image and textbox. The textbox has an expression in it's Hidden property based on the column name. The report renders fine on screen. When the report is exported to Excel, CSV, XML the textbox contents are not output (the images display as expected). I've tried setting the DataElementOutput to Output/Yes with no success. Exporting to TIFF, PDF, Web Archive/MTHML is fine.

Here is a sample RDL which exhibits the issue:

<?xml version="1.0" encoding="utf-8"?>

<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

<DataSources>

<DataSource Name="Gemini50DataSource">

<DataSourceReference>Gemini50DataSource</DataSourceReference>

<rdBig SmileataSourceID>bb03313c-48a4-4e40-af99-ed584847ca20</rdBig SmileataSourceID>

</DataSource>

</DataSources>

<BottomMargin>1in</BottomMargin>

<RightMargin>1in</RightMargin>

<ReportParameters>

<ReportParameter Name="ImagePath">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>c:\</Value>

</Values>

</DefaultValue>

<Prompt>Image Path</Prompt>

</ReportParameter>

</ReportParameters>

<rdBig SmilerawGrid>true</rdBig SmilerawGrid>

<InteractiveWidth>8.5in</InteractiveWidth>

<rdTongue TiednapToGrid>true</rdTongue TiednapToGrid>

<Body>

<ReportItems>

<Matrix Name="matrix1">

<MatrixColumns>

<MatrixColumn>

<Width>3.75in</Width>

</MatrixColumn>

</MatrixColumns>

<RowGroupings>

<RowGrouping>

<Width>1.75in</Width>

<DynamicRows>

<ReportItems>

<Textbox Name="PicIndex">

<rdBig SmileefaultName>PicIndex</rdBig SmileefaultName>

<ZIndex>1</ZIndex>

<Style>

<TextAlign>Right</TextAlign>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value>=Fields!PicIndex.Value</Value>

</Textbox>

</ReportItems>

<Grouping Name="matrix1_PicIndex">

<GroupExpressions>

<GroupExpression>=Fields!PicIndex.Value</GroupExpression>

</GroupExpressions>

</Grouping>

</DynamicRows>

</RowGrouping>

</RowGroupings>

<ColumnGroupings>

<ColumnGrouping>

<DynamicColumns>

<ReportItems>

<Textbox Name="ColumnName">

<rdBig SmileefaultName>ColumnName</rdBig SmileefaultName>

<ZIndex>2</ZIndex>

<Style>

<BorderStyle>

<Default>Solid</Default>

</BorderStyle>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<BackgroundColor>LightBlue</BackgroundColor>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value>=Fields!ColumnName.Value</Value>

</Textbox>

</ReportItems>

<Grouping Name="matrix1_ColumnName">

<GroupExpressions>

<GroupExpression>=Fields!ColumnName.Value</GroupExpression>

</GroupExpressions>

</Grouping>

</DynamicColumns>

<Height>0.25in</Height>

</ColumnGrouping>

</ColumnGroupings>

<DataSetName>DataSet2</DataSetName>

<Width>5.5in</Width>

<Corner>

<ReportItems>

<Textbox Name="textbox1">

<rdBig SmileefaultName>textbox1</rdBig SmileefaultName>

<ZIndex>3</ZIndex>

<Style>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Value />

</Textbox>

</ReportItems>

</Corner>

<Height>0.55208in</Height>

<MatrixRows>

<MatrixRow>

<Height>0.30208in</Height>

<MatrixCells>

<MatrixCell>

<ReportItems>

<Rectangle Name="rectangle1">

<ReportItems>

<Image Name="image1">

<Sizing>AutoSize</Sizing>

<Left>0.25in</Left>

<MIMEType />

<ZIndex>1</ZIndex>

<Visibility>

<Hidden>=IIF(First(Fields!ColumnName.Value = "image"), Len(Fields!CellValue.Value)=0, true)</Hidden>

</Visibility>

<Width>0.3in</Width>

<Source>External</Source>

<Style />

<Value>="file:" + Parameters!ImagePath.Value + Fields!CellValue.Value</Value>

</Image>

<Textbox Name="textbox2">

<Left>1.625in</Left>

<DataElementOutput>Output</DataElementOutput>

<rdBig SmileefaultName>textbox2</rdBig SmileefaultName>

<Visibility>

<Hidden>=IIF(Fields!ColumnName.Value &lt;&gt; "image", False, True)</Hidden>

</Visibility>

<Width>1.875in</Width>

<Style>

<PaddingLeft>2pt</PaddingLeft>

<PaddingBottom>2pt</PaddingBottom>

<BackgroundColor>PeachPuff</BackgroundColor>

<PaddingRight>2pt</PaddingRight>

<PaddingTop>2pt</PaddingTop>

</Style>

<CanGrow>true</CanGrow>

<Height>0.25in</Height>

<Value>=Fields!CellValue.Value</Value>

</Textbox>

</ReportItems>

<Visibility>

<Hidden>=IIF(True, False, True)</Hidden>

</Visibility>

<Style>

<BorderStyle>

<Default>Solid</Default>

</BorderStyle>

<BackgroundColor>LightGrey</BackgroundColor>

</Style>

</Rectangle>

</ReportItems>

</MatrixCell>

</MatrixCells>

</MatrixRow>

</MatrixRows>

</Matrix>

</ReportItems>

<Height>0.625in</Height>

</Body>

<rd:ReportID>a944d20c-558a-4805-9d4c-aecc9757f678</rd:ReportID>

<LeftMargin>1in</LeftMargin>

<DataSets>

<DataSet Name="DataSet2">

<Query>

<rd:UseGenericDesigner>true</rd:UseGenericDesigner>

<CommandText>SELECT 1 as PicIndex, 'image' as ColumnName, 'image1.jpg' as CellValue

union

SELECT 2,'image','image2.jpg'

union

SELECT 3,'image','image3.jpg'

union

SELECT 4,'image',null

union

SELECT 5,'something else',null

union

SELECT 6,'another column', 'display my text!'</CommandText>

<DataSourceName>Gemini50DataSource</DataSourceName>

</Query>

<Fields>

<Field Name="PicIndex">

<rd:TypeName>System.Int32</rd:TypeName>

<DataField>PicIndex</DataField>

</Field>

<Field Name="ColumnName">

<rd:TypeName>System.String</rd:TypeName>

<DataField>ColumnName</DataField>

</Field>

<Field Name="CellValue">

<rd:TypeName>System.String</rd:TypeName>

<DataField>CellValue</DataField>

</Field>

</Fields>

</DataSet>

</DataSets>

<Width>5.625in</Width>

<InteractiveHeight>11in</InteractiveHeight>

<Language>en-US</Language>

<TopMargin>1in</TopMargin>

</Report>

Here is a posting related to this that may help.

http://blogs.msdn.com/bimusings/archive/2007/02/07/reporting-services-why-aren-t-all-my-report-columns-exporting-to-csv-and-or-xml.aspx

cheers,

Andrew

|||

Andrew,

Thanks for the posting. I've seen that blog. Unfortunately, the "good news" wasn't so good for this case. The setting of DataElementOutput(yes, no, auto) has no effect on the output for the situation described . If you find any other possibilities I would very much appreciate it.

Thanks,

Brian

export to excel question

i used matrix control.

Grouping and Sorting Property

I checked the property

visibility can be to toggled by another report item

report show is right. the item is toggled by another report item

but export the excel file

the report item is not togled by another report item

the excel show like a table.

how can i set the excel show.

set the item is toggled by another report item

this is i want .

JAPAN TOTAL
TKY MET-1 SD
TKY MET-2 SD

this is not i want

JAPAN TOTAL
TKY MET-1 SD
TOKYO-1
TOKYO-2
TOKYO-3
TOKYO-4
TOKYO-5
TKY MET-2 SD

please explain your question.|||

sorry, I am not explain my question.

Friday, February 24, 2012

Export to Excel - Fit to one page property?

It is possible to set scaling property "fit to ... page(s) wide" = 1 (menu "File" ->"Page Setup") , when I export report to Excel from Reporting Services 2005?

Thank you

Fit to Page is not currently supported in the Excel renderer.

-Chris

|||

If you go to:

menu>reoprt> report properties

click on the layout tab and change the size to what ever you need probably bigger, that should do it.

-Rohit

|||
I use the following code to format Excel on Export from my .net page
everything works except the line "sb.Append"<x:FitToPage>true</x:FitToPage>".

I've tried "yes", "1", "true", none worked.

I read at a couple sites that FitToPage is not supported in Excel.

Response.Write(AddExcelStyling())

Private Function AddExcelStyling() As String

Dim sb As New StringBuilder()

sb.Append("<html xmlns:o='urn:schemas-microsoft-com:office:office'" & Chr(10) & "" + "xmlns:x='urn:schemas-microsoft-com:office:excel'" & Chr(10) & "" + "xmlns='http://www.w3.org/TR/REC-html40'>" & Chr(10) & "" + "<head>" & Chr(10) & "")
sb.Append("<style>" & Chr(10) & "")

sb.Append("@.page")
sb.Append("{margin:.25in .5in .25in .5in;" & Chr(10) & "")

sb.Append("mso-header-margin:.5in;" & Chr(10) & "")

sb.Append("mso-footer-margin:.5in;" & Chr(10) & "")
sb.Append("{size:11in 8.5in; " & Chr(10) & "")
sb.Append("mso-page-orientation:landscape;}" & Chr(10) & "")
sb.Append("</style>" & Chr(10) & "")

sb.Append("<!--[if gte mso 9]><xml>" & Chr(10) & "")
sb.Append("<x:ExcelWorkbook>" & Chr(10) & "")

sb.Append("<x:ExcelWorksheets>" & Chr(10) & "")
sb.Append("<x:ExcelWorksheet>" & Chr(10) & "")

sb.Append("<x:Name> </x:Name>" & Chr(10) & "")
sb.Append("<x:WorksheetOptions>" & Chr(10) & "")

sb.Append("<x:Print>" & Chr(10) & "")
sb.Append("<x:ValidPrinterInfo/>" & Chr(10) & "")
sb.Append("<x:FitToPage>true</x:FitToPage>" & Chr(10) & "")

sb.Append("<x:PaperSizeIndex>9</x:PaperSizeIndex>" & Chr(10) & "")
sb.Append("<x:HorizontalResolution>600</x:HorizontalResolution" & Chr(10) & "")

sb.Append("<x:VerticalResolution>600</x:VerticalResolution" & Chr(10) & "")
sb.Append("</x:Print>" & Chr(10) & "")

sb.Append("<x:Selected/>" & Chr(10) & "")
sb.Append("<x:DoNotDisplayGridlines/>" & Chr(10) & "")

sb.Append("<x:ProtectContents>False</x:ProtectContents>" & Chr(10) & "")
sb.Append("<x:ProtectObjects>False</x:ProtectObjects>" & Chr(10) & "")

sb.Append("<x:ProtectScenarios>False</x:ProtectScenarios>" & Chr(10) & "")
sb.Append("</x:WorksheetOptions>" & Chr(10) & "")

sb.Append("</x:ExcelWorksheet>" & Chr(10) & "")
sb.Append("</x:ExcelWorksheets>" & Chr(10) & "")

sb.Append("<x:WindowHeight>12780</x:WindowHeight>" & Chr(10) & "")
sb.Append("<x:WindowWidth>10035</x:WindowWidth>" & Chr(10) & "")

sb.Append("<x:WindowTopX>0</x:WindowTopX>" & Chr(10) & "")
sb.Append("<x:WindowTopY>15</x:WindowTopY>" & Chr(10) & "")

sb.Append("<x:ProtectStructure>False</x:ProtectStructure>" & Chr(10) & "")
sb.Append("<x:ProtectWindows>False</x:ProtectWindows>" & Chr(10) & "")

sb.Append("</x:ExcelWorkbook>" & Chr(10) & "")
sb.Append("</xml><![endif]-->" & Chr(10) & "")

sb.Append("</head>" & Chr(10) & "")
sb.Append("<body>" & Chr(10) & "")

Return sb.ToString()
End Function