-1

I have cfspreadhsheet which is working fine for downloading the contents. Now I do have attachments for the records. When i am exporting the Export to excel, I want to add that zip file to it also in new sheet. I checked in the docs, there is a function called spreadSheetAddImage.

Till now, I am doing like this and need to add some things here

<cfquery datasource="#request.dsn#" name="fetch">
    SELECT * from mytable 
    </cfquery>
  <cfset filename = "Tickets" & dateformat(now(),'mm_dd_yyyy') & "." & "xls">
  <cfset s = spreadsheetNew("Summary")>
  <!--- Add header row --->
  <cfset spreadsheetAddRow(s, "ID,Date Raised,Summary,Raised By,AssignedTo,Status,Last Updated Date, Time Spent, Ticket Type, Last Updated Comment")>
  <!--- format header --->
  <cfset spreadsheetFormatRow(s,{bold=true,fgcolor="lemon_chiffon",fontsize=12,border=1},1)>
  <cfset spreadsheetAddRows(s, fetch)>
  <cfset SpreadsheetFormatColumn(s,{textwrap=true},10)>
  <cfset spreadsheetWrite(s, filename, true)>
Leigh
  • 28,765
  • 10
  • 55
  • 103
  • 3
    Have you considered using `cfzip` to put the spreadsheet and all peripheral files into a zip file instead of using the spreadsheet as the package? – genericHCU May 03 '13 at 11:28
  • 1
    Embedding arbitrary files is not supported, only images. If you simply need to package multiple files, cfzip (as Travis suggested) is a better option. – Leigh May 03 '13 at 19:03
  • The answer is here, Go ahead and check, modified as per "Travis" http://stackoverflow.com/questions/16539016/issues-with-cfzip-functionality/16560330#16560330 and do not make my questions negative, – Gurpreet Singh May 15 '13 at 08:44
  • That is an answer to a different question. The answer to this one is: that functionality is not supported in CF. CFZip can be used as an alternative. @Travis should post that as an answer. – Leigh May 16 '13 at 00:17
  • don't mark my question negative, question is never invalid – Gurpreet Singh May 16 '13 at 06:45
  • 2
    Answers are usually marked down if they do not contain the information needed to answer it. For example, questions should contain code, what you have tried, how it "doesn't work", error messages, troubleshooting steps, etc. I didn't vote your question down but If I had to guess, I would say this question was voted down because it did not contain an actual question. we can infer you are trying to ask "How do I embed a zip file to a spreadsheet using `cfspreadsheet`", but it was never specifically asked. – genericHCU May 16 '13 at 10:47
  • 1
    Questions are typically [downvoted](http://stackoverflow.com/privileges/vote-down) if they are unclear, or demonstrate a lack of effort. A good question is more than just a code dump. It includes a clear description of 1) the goal 2) actual versus expected results and 3) the relevant code and 4) any error messages. If you are frequently receiving down votes, then you may want to review [some](http://catb.org/~esr/faqs/smart-questions.html) [guidelines](http://stackoverflow.com/questions/how-to-ask) and focus on how you can improve your questions. – Leigh May 16 '13 at 17:52
  • Just want to say that in here in "Stackoverflow" i have seen many questions which are undoubtedly asked as "Pathetic", sometimes reading questions does not understand what they need, and people who answers below ask again, what exactly you need, but my questions always seems bad to you people without any cause. Well do not want to indulge in Issues here, I sorted my Own Questions. – Gurpreet Singh May 17 '13 at 11:50

1 Answers1

2

So it looks like you decided to use CFZip per my suggestion and the assist by Leigh in the comments. For the sake of closure here it is in answer format.

ColdFusion does not allow you to embed files other than images into your spreadsheet. If you need to package multiple file types together, using CFZip would be the best way to handle your requirement.

genericHCU
  • 4,394
  • 2
  • 22
  • 34