Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When saveas to XLSX is not working according to its parameter #170

Open
mustafabozkurt1 opened this issue Feb 12, 2018 · 0 comments
Open

Comments

@mustafabozkurt1
Copy link

I have a report having pYear parameter and default value=2018.
In runtime when I run the report having parameter value=2017 and trying to saveas to xlsx format.It saveas report according to parameter value=2018.

In my application, there are different choices for saveas (pdf, xml, html, csv, rtf, tif, excell, mht)
PDF and TIF is working properly according to the choosen parameter, but others is working only for defalt parameter value.

Thaks in advance!!!

My vb.net code is below;
Public Sub RaporMenu(ByVal sender As Object, ByVal e As System.EventArgs)
'MsgBox(sender.ToString)
Select Case sender.ToString
Case "Open"
Dim dlg As New OpenFileDialog()
If (dlg.ShowDialog() <> DialogResult.OK) Then
Return
End If
rdlViewer.SourceFile = New Uri(dlg.FileName)
rdlViewer.Rebuild()

            Case "Save As"
                Dim dlg As New SaveFileDialog()
                dlg.Filter = "PDF files|*.pdf|XML files|*.xml|HTML files|*.html|CSV files|*.csv|RTF files|*.rtf|TIF files|*.tif|Excel files|*.xlsx|MHT files|*.mht"
                dlg.FileName = ".pdf"
                If (dlg.ShowDialog() <> DialogResult.OK) Then
                    Return
                End If
                Dim ext As String = ""
                Dim i As Integer = dlg.FileName.LastIndexOf(".")
                If i < 1 Then
                    ext = ""
                Else
                    ext = dlg.FileName.Substring(i + 1).ToLower()
                End If
                Dim type As New fyiReporting.RDL.OutputPresentationType
                Select Case ext
                    Case "pdf"
                        type = fyiReporting.RDL.OutputPresentationType.PDF
                    Case "xml"
                        type = fyiReporting.RDL.OutputPresentationType.XML
                    Case "html"
                        type = fyiReporting.RDL.OutputPresentationType.HTML
                    Case "htm"
                        type = fyiReporting.RDL.OutputPresentationType.HTML
                    Case "csv"
                        type = fyiReporting.RDL.OutputPresentationType.CSV
                    Case "rtf"
                        type = fyiReporting.RDL.OutputPresentationType.RTF
                    Case "mht"
                        type = fyiReporting.RDL.OutputPresentationType.MHTML
                    Case "mhtml"
                        type = fyiReporting.RDL.OutputPresentationType.MHTML
                    Case "xlsx"
                        type = fyiReporting.RDL.OutputPresentationType.Excel
                    Case "tif"
                        type = fyiReporting.RDL.OutputPresentationType.TIF
                    Case "tiff"
                        type = fyiReporting.RDL.OutputPresentationType.TIF
                    Case Else
                        MessageBox.Show(String.Format("{0} is not a valid file type. File extension must be PDF, XML, HTML, CSV, MHT, RTF, TIF, XLSX.", dlg.FileName),
                            "Invalid File Type", MessageBoxButtons.OK, MessageBoxIcon.Information)
                End Select                    

                rdlViewer.SaveAs(dlg.FileName, type)

            Case "Print"
                Dim pd As New PrintDocument
                pd.DocumentName = rdlViewer.SourceFile.LocalPath
                pd.PrinterSettings.FromPage = 1
                pd.PrinterSettings.ToPage = rdlViewer.PageCount
                pd.PrinterSettings.MaximumPage = rdlViewer.PageCount
                pd.PrinterSettings.MinimumPage = 1
                If rdlViewer.PageWidth > rdlViewer.PageHeight Then
                    pd.DefaultPageSettings.Landscape = True
                Else
                    pd.DefaultPageSettings.Landscape = False
                End If
                Dim dlg As New PrintDialog
                dlg.Document = pd
                dlg.AllowSelection = True
                dlg.AllowSomePages = True
                If (dlg.ShowDialog() = DialogResult.OK) Then
                    rdlViewer.Print(pd)
                End If
            Case "First Page"
                rdlViewer.PageCurrent = 1
            Case "Previous Page"
                If (rdlViewer.PageCurrent = 1) Then
                    Return
                Else
                    rdlViewer.PageCurrent -= 1
                End If
            Case "Next Page"
                If (rdlViewer.PageCurrent = rdlViewer.PageCount) Then
                    Return
                Else
                    rdlViewer.PageCurrent += 1
                End If
            Case "Last Page"
                rdlViewer.PageCurrent = rdlViewer.PageCount
            Case "Zoom In"
                rdlViewer.Zoom -= 0.5F
            Case "Zoom Out"
                rdlViewer.Zoom -= 0.5F
        End Select
    End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant