Can any body plz post codes to generate Xml from a excel spreadsheet the xml shud generate for each row of the spreadsheet that is there is a excel sheet....with lots of rows(random) & columns(random) now i have to generate xml for each row thanx -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 7, 8:40 am, Sumanta Das <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Can any body plz post codes to generate Xml from a excel spreadsheet > the xml shud generate for each row of the spreadsheet > that is there is a excel sheet....with lots of rows(random) & > columns(random) > now i have to generate xml for each row > thanxOoh, a mystery. You''ve given us a clue as to what your problem is, without giving away the whole thing. Mind if I play along? I''ll give you an answer, and then maybe you can provide more clues as to what you''re looking for. Fun stuff. From Excel 2007: File -> Save As -> XML Spreadsheet (2003) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can also try using the FasterCSV library to convert it to xml -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 07/04/2008, Sumanta Das <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Can any body plz post codes to generate Xml from a excel spreadsheet > the xml shud generate for each row of the spreadsheet > that is there is a excel sheet....with lots of rows(random) & > columns(random) > now i have to generate xml for each rowthere are two gems at rubyforge which can read excel-files: ''parseexcel'' and ''roo''. Depending on your needs all you have to do is outputting an xml-document. -Thomas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thomas Preymesser wrote:> On 07/04/2008, Sumanta Das <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> >> Can any body plz post codes to generate Xml from a excel spreadsheet >> the xml shud generate for each row of the spreadsheet >> that is there is a excel sheet....with lots of rows(random) & >> columns(random) >> now i have to generate xml for each row > > > there are two gems at rubyforge which can read excel-files: > > ''parseexcel'' and ''roo''. > > Depending on your needs all you have to do is outputting an > xml-document. > > -Thomasi am using parse excel................. & i am very new in ruby............ i am using ruby 128-26 & MS-OFFICE 2007 is in my machine so plz if post some usefull code with details......... thanx -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Thomas wrote:> On Apr 7, 8:40�am, Sumanta Das <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> Can any body plz post codes to generate Xml from a excel spreadsheet >> the xml shud generate for each row of the spreadsheet >> that is there is a excel sheet....with lots of rows(random) & >> columns(random) >> now i have to generate xml for each row >> thanx > > Ooh, a mystery. You''ve given us a clue as to what your problem is, > without giving away the whole thing. Mind if I play along? I''ll give > you an answer, and then maybe you can provide more clues as to what > you''re looking for. Fun stuff. > > From Excel 2007: File -> Save As -> XML Spreadsheet (2003)i know the above way but my office 2007 is not supporting this..... error mapping is showing that no xml mapping is in my spread sheet.... and i want ruby code for that................. i am using parse excel................. & i am very new in ruby............ i am using ruby 128-26 & MS-OFFICE 2007 is in my machine so plz if post some usefull code with details......... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Mr wrote:> You can also try using the FasterCSV library to convert it to xmlhow can i do that......... will u plz inform me in details now i am using parse excel................. & i am very new in ruby............ i am using ruby 128-26 & MS-OFFICE 2007 is in my machine so plz if post some usefull code with details......... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 8, 1:11 am, Sumanta Das <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Mark Thomas wrote: > > On Apr 7, 8:40�am, Sumanta Das <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > >> Can any body plz post codes to generate Xml from a excel spreadsheet > >> the xml shud generate for each row of the spreadsheet > >> that is there is a excel sheet....with lots of rows(random) & > >> columns(random) > >> now i have to generate xml for each row > >> thanx > > > Ooh, a mystery. You''ve given us a clue as to what your problem is, > > without giving away the whole thing. Mind if I play along? I''ll give > > you an answer, and then maybe you can provide more clues as to what > > you''re looking for. Fun stuff. > > > From Excel 2007: File -> Save As -> XML Spreadsheet (2003) > > i know the above way but my office 2007 is not supporting this..... > error mapping is showing that no xml mapping is in my spread sheet....Yes, it does. Your actions may look more like the following: Office Logo button -> Save As -> Other Formats. Choose ''XML Spreadsheet 2003 (*.xml)'' from the Save As Type drop-down.> and i want ruby code for that.................OK, fair enough. But since this is a Rails forum, your question would have been better in comp.lang.ruby.> i am using parse excel.................Are you USING it? Like, you''ve installed it, read through the APIs and online tutorials enough to try something? If so, then post a code snippet (preferably to comp.lang.ruby) along with what you want it to do, and people will be happy to help.> & i am very new in ruby............ > i am using ruby 128-26 > & MS-OFFICE 2007 is in my machineSo you are using Windows with Excel installed. You also have the option of automating excel with Win32-OLE. See http://rubyonwindows.blogspot.com/search/label/excel for details.> so plz if post some usefull code with details.........Code samples can be found with web searches. If you can show that you''ve at least TRIED to solve this problem on your own, by providing some of your own code, working or not, people are more likely to help. - Mark. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i have done excel to xml conversion like this but the problem is...if i rename the "d:\database\terget.txt" to "d:\database\terget.xml" then the file is not opening as a xml file & " The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. -------------------------------------------------------------------------------- Invalid at the top level of the document. Error processing resource ''file:///D:/database/terget.xml''. Line 1, Position 1 - <CAS>10043-35-3</CAS> " ^ this error messege is generated but if i use this as text file it is opening in internet explorer. & another thing is that if i want to use 1)dynamic path to select the source excel file... what should i do? 2)& the features of xml in this file that is the expanding & Collapseing features by ''-'' & ''+'' sign i want to add, but how? its very urgent realy thanx Attachments: http://www.ruby-forum.com/attachment/1722/xml.rb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
require ''parseexcel'' require ''win32ole'' require ''roo'' workbook = Spreadsheet::ParseExcel.parse(''d:\source.xls'') worksheet = workbook.worksheet(0) puts @C = 0 @r = 0 @header = [] @fn=[] skip = 0 worksheet.each(skip){|row| first_cell = row File.open(''d:\test.txt'',''a'') do |f| if @r < 1 @C = first_cell.length for l in 0...@C @header[l] = first_cell[l].to_s(''latin1'') end end @r = @r +1 end } skip =1 @cnt=0 worksheet.each(skip) { |row| File.open(''d:\database\terget.xml'',''a'') do |file| first_cell=row for l in 0...@C if first_cell[l] !=nil str = first_cell[l].to_s(''latin1'') else str = '' '' end file.puts "- <" + @header[l] + ">" + str + "</" + @header[l]+ ">" file.puts end end @cnt= @cnt+1 } Attachments: http://www.ruby-forum.com/attachment/1723/xml.rb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11 Apr 2008, at 10:53, Sumanta Das wrote:> > 2)& the features of xml in this file that is the expanding & > Collapseing > features by ''-'' & ''+'' sign i want to add, but how? > its very urgent realy > thanxUmm that''s not an xml thing. The program displaying the xml may choose to do that, but that''s absolutely not somthing that should be in the xml itself. (and it looks like that''s what''s causing your parse error) Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
but can u help me on that........................ if u can help me by submitting code in reply that will be realy helpfull for me its urgent please............... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11 Apr 2008, at 11:37, Sumanta Das wrote:> > but can u help me on that........................ > if u can help me by submitting code in reply that will be realy > helpfull > for me > its urgent please...............There is absolutely nothing that you can put in an xml file that will make the elements be collapsable. xml just describes some data, it doesn''t care about how it''s displayed. The program displaying the data may choose to do nice things such as some form of syntax highlighting. If you stick a bare xml document into firefox for example, you''ll get your collapsable nodes, because that''s just how firefox likes to display xml. If you need more then you could always right an xsl stylesheet that transforms the xml into an html document with all the GUI niceties that you want. Fred> > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> There is absolutely nothing that you can put in an xml file that will > make the elements be collapsable. xml just describes some data, it > doesn''t care about how it''s displayed. The program displaying the data > may choose to do nice things such as some form of syntax highlighting. > If you stick a bare xml document into firefox for example, you''ll get > your collapsable nodes, because that''s just how firefox likes to > display xml. If you need more then you could always right an xsl > stylesheet that transforms the xml into an html document with all the > GUI niceties that you want. >but in my project have to read excel file& i have to generate xml for each row individualy...& all the xml should in a common file as i want to do there.... now can u help me by submitting some code to me?? that will be really helpfuul to me Which u want to say above i know that...but i can''t reach the goal thats why i am submitting the code,asked for solution.... can u help me(coding+advice) to solve it?????? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11 Apr 2008, at 12:04, Sumanta Das wrote:> >> There is absolutely nothing that you can put in an xml file that will >> make the elements be collapsable. xml just describes some data, it >> doesn''t care about how it''s displayed. The program displaying the >> data >> may choose to do nice things such as some form of syntax >> highlighting. >> If you stick a bare xml document into firefox for example, you''ll get >> your collapsable nodes, because that''s just how firefox likes to >> display xml. If you need more then you could always right an xsl >> stylesheet that transforms the xml into an html document with all the >> GUI niceties that you want. >> > > > > > but in my project have to read excel file& i have to generate xml for > each row individualy...& all the xml should in a common file as i want > to do there.... > now can u help me by submitting some code to me?? > that will be really helpfuul to me > Which u want to say above i know that...but i can''t reach the goal > thats > why i am submitting the code,asked for solution.... > can u help me(coding+advice) to solve it??????As far as the xml generation goes, you should probably look a something like builder (as it is you could very easily be generating invalid xml if the cells contain any of the forbidden characters. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
plz provide some code/example -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11 Apr 2008, at 12:28, Sumanta Das wrote:> > plz provide some code/examplehttp://builder.rubyforge.org/> > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---