이 작업을 수행하는 방법을 알고있는 유일한 방법은 런타임 중에 RDLC 파일을 변경하는 것입니다. 기본적으로 RLDC 파일을 메모리 (XML 파일)에로드하고 테이블 너비를 포함하는 XML 노드를 찾은 다음 메모리의 설정을 수정할 수 있습니다. 이 작업을 완료하면 메모리에로드 된 RDLC 파일을 사용하여 reportViewer 컨트롤을 새로 고칠 수 있습니다.
그리고 예, 이미이 작업을 수행했으며 작동합니다.
--- EDIT --- 다음 코드 예제는 XMLpath를 통해 메모리에있는 RDLC 파일의 데이터를 변경하는 것입니다.
Private Sub ModifyRDLCInMemory()
Dim xmlDoc As XmlDocument = New XmlDocument
Dim asm As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
'create in memory, a XML file from a embedded resource
Dim xmlStream As Stream = asm.GetManifestResourceStream(ReportViewer1.LocalReport.ReportEmbeddedResource)
Try
'Load the RDLC file into a XML doc
xmlDoc.Load(xmlStream)
Catch e As Exception
MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
End Try
'Create an XmlNamespaceManager to resolve the default namespace
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("nm", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition")
nsmgr.AddNamespace("rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner")
'Loop through each node in the XML file
Dim node As XmlNode
For Each node In xmlDoc.DocumentElement.SelectNodes(String.Format("//nm:{0}[@rd:LocID]", "Value"), nsmgr) 'XPath to LocID node.. You will want to change this to locate your Table Width node. You may need to read up on XMLPath
Dim nodeValue As String = node.InnerText 'Gets current value of Node
If (String.IsNullOrEmpty(nodeValue) Or Not nodeValue.StartsWith("=")) Then
Try
node.InnerText = YOURNEWVALUE
Catch ex As Exception
'handle error
End Try
End If
Next
ReportViewer1.LocalReport.ReportPath = String.Empty
ReportViewer1.LocalReport.ReportEmbeddedResource = Nothing
'Load the updated RDLC document into LocalReport object.
Dim rdlcOutputStream As StringReader = New StringReader(xmlDoc.DocumentElement.OuterXml)
Using rdlcOutputStream
ReportViewer1.LocalReport.LoadReportDefinition(rdlcOutputStream)
End Using
End Sub
특정 열이 보이지 않을 때 전체 테이블을 포함하도록 모든 열의 크기를 조정 하시겠습니까? – shahkalpesh
그게 효과가있다. 열의 1 또는 2 크기를 조정하면 해결할 수 있습니다. 테이블이 너비가 같을뿐입니다. – JoeB