Friday, February 17, 2012

Creating Excel Output for Mac Excel 2004

I am experiencing issues with SQL Server Reporting Services 2000 when
rendering Excel (.xls) output on a Mac. The Mac is running Excel 2004 for
the Mac and appears to download the .xls file successfully, but just hangs
when attempting to open the file.
All other reporting services formats seem to render fine (html, pdf, .csv,
etc) though the HTML that gets rendered in Firefox or Safari doesn't look the
same nor nearly as nice as in IE, but it does render.
Are there service packs, hot fixes, or the like for either SSRS 2000 or
Excel 2004 for the Mac? Or is this just a case where that version of Excel
on the Mac isn't supported by SSRS 2000?
--
PaulHelo Paul,
Yes, this is a known issue in Reporting Services 2000 and Reporting
Services 2005.
For Reporting Services 2000, the MAC development group confirmed the
problem was in the .XLS file itself rendered from SQL Reporting Services.
Apparently there is certain information in the XLS file that is read by the
Mac version but not the PC version and it is this information that was
causing the file to not open or hang. The bug has been reported to the SQL
Reporting Services Product group, but I haven't been able to find a fix as
yet.
I'll include the VB code below which may helpful for you.
'Sample Program to automate process of opening and resaving XLS files
rendered by
Reporting Services and then email the file as an attachment to specified
address
locations
'This sample program was designed to run from the same location that the
XLS files
are rendered to
'Sample Command Line:
' c:>Project1.exe book1.xls
Private Sub Form_Load()
Me.Visible = False
pXLSFile = GetCommandLine()
ReSaveXLS (pXLSFile)
CreateEmail (pXLSFile)
Unload Me
End Sub
Private Sub ReSaveXLS(pXLSFile)
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
'Start new instance of Excel using Automation:
Set xlApp = CreateObject("Excel.Application")
'Optional: Use if want to see Excel and let user close it:
xlApp.Visible = False
xlApp.UserControl = False
'Open the workbook that contains the data and macro:
Set xlBook = xlApp.Workbooks.Open(App.Path & "\" & pXLSFile)
'Save changes to the workbook:
'This line may need to be changed to call the SaveAs method.
xlBook.Save
'Quit Excel:
xlApp.Quit
'Release object variables:
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
Private Sub CreateEmail(pXLSFile)
'from Q286431
' Send by connecting to port 25 of the SMTP server.
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
'Const cdoSendUsingPort = 25
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
With Flds
'.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
'The value from below should be the same as what is located
RSReportServer.config between the <SMTPServer> tags
Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.unistudios.com" '<remote SMTP server>
Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
) =10
Update
End With
' Build HTML for message body.
strHTML = "&
"
strHTML = strHTML & ""
strHTML = strHTML & ""
strHTML = strHTML & " This is the test HTML message body"
strHTML = strHTML & ""
strHTML = strHTML & "
"
' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
To = "matthofa@.microsoft.com" 'ToDo: Enter a valid email address.
From = "matthofa@.microsoft.com" 'ToDo: Enter a valid email address.
Subject = "This is a test CDOSYS message."
HTMLBody = strHTML
AddAttachment (App.Path & "\" & pXLSFile)
Send
End With
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
End Sub
Function GetCommandLine(Optional MaxArgs)
'Declare variables.
Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs
'See if MaxArgs was provided.
If IsMissing(MaxArgs) Then MaxArgs = 10
'Make array of the correct size.
ReDim ArgArray(MaxArgs)
NumArgs = 0: InArg = False
'Get command line arguments.
CmdLine = Command()
CmdLnLen = Len(CmdLine)
'Go thru command line one character
'at a time.
For I = 1 To CmdLnLen
C = Mid(CmdLine, I, 1)
'Test for space or tab.
If (C <> " " And C <> vbTab) Then
'Neither space nor tab.
'Test if already in argument.
If Not InArg Then
'New argument begins.
'Test for too many arguments.
If NumArgs = MaxArgs Then Exit For
NumArgs = NumArgs + 1
InArg = True
End If
'Concatenate character to current argument.
ArgArray(NumArgs) = ArgArray(NumArgs) & C
Else
'Found a space or tab.
'Set InArg flag to False.
InArg = False
End If
Next I
'Resize array just enough to hold arguments.
ReDim Preserve ArgArray(NumArgs)
'Return Array in Function name.
GetCommandLine = ArgArray(1)
End Function
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.

No comments:

Post a Comment