2015-01-20 22:22 GMT+01:00 James Plante <jimpla...@me.com>: > Just to be a pedantic nit-picker, "csv" stands for "character separated > values," not "comma separated values." You choose which character. >
Okay, sorry. I read ”comma separated values” at Wikipedia a while ago, but now when I look there again, they also mention ”character separated values”. Not that Wikipedia is the world center of all truth, but in many cases it's okay to look there anyway… And I don't have anything against ”pedantic nit-pickers”, I'm a little bit of one myself (which of course doesn't mean that I can't be wrong in some cases…). I love to learn things, so please continue to be a pedantic nit-picker. I think that's appromimately the same as what we in my country call a ”besserwisser”, even though it's not the language we speak here. We borrowed that one from the Germans… And sometimes when we want to be funny, we pronounce it slightly wrong: ”Messerschmitt”… Kind regards Johnny Rosenberg ジョニー・ローゼンバーグ > > Hence, the "9" in your arguments to tell it to separate with tabs. You can > choose commas, semicolons, or just about any other character. > > Jim > > > On Jan 20, 2015, at 2:00 PM, Johnny Rosenberg <gurus.knu...@gmail.com> > wrote: > > > > 2015-01-20 12:49 GMT+01:00 Stuart Murray <s.mur...@hart-builders.co.uk>: > > > >> When I save information as a CSV file it brings up the text import > window. > >> I click on ok and then it always opens the file. Is there a way of > >> preventing the file from opening when I click on ok? I do this several > >> times a day every day so each file saved needs to be closed after it is > >> saved. It's not the end of the world but it would save a little time > each > >> day and the make the process sleeker for the dozen or so files I am > saving > >> all at the same time each day. > >> > >> Many thanks > >> > >> Stuart > >> > >> > > I'm afraid I can't answer your question, but I still have something to > say, > > I think. > > > > I had a couple of spreadsheets that I needed to convert to csv (or rather > > tsv – Tab Separated Values, but I still used the .csv suffix) and copy it > > to my Android phone, so I could view it there with a simple csv app… > > > > I used a macro for it and I ran the macro by pushing a button that I > added > > to the first row of the spreadsheet. That row is always visible, since I > > use the Freeze feature, otherwise I could run the macro from the > keyboard, > > add a menu item or something. > > > > Anyway, I only needed this for one or two particular document, so some > > things in my macro are hard coded. I just wanted to get the job done, so > to > > speak… > > > > Here it is. If you want to use it, you need to edit at least the hard > coded > > path (which is faked in this version anyway)… > > I removed the part where it moves the csv to the phone, since that part > is > > done by a Bash script anyway, called from the macro. > > > > Sub SaveAsCsv > > ' Place the cursor at the first unused row. > > Call SelectRow > > > > ' Then, save the spreadsheet. > > ThisComponent.store() > > > > ' Now, save the active sheet as CSV. > > Dim PropVal(1) as New com.sun.star.beans.PropertyValue > > PropVal(0).Name="FilterName" > > PropVal(0).Value="Text - txt - csv (StarCalc)" > > PropVal(1).Name="FilterOptions" > > REM You need to edit the line below if you prefer saving as csv rather > than > > tsv. > > REM I don't remember which number means what, but I remember that I > > REM ”Googled it” to determine the number that I actually used. A wild > guess > > REM would be that the 9 means TAB (since that is its ASCII-code), but I'm > > REM sure some ”Googling” will get the right numbers for you. > > PropVal(1).Value ="9,34,0,1,1" > > > > Dim FileURL As String, FilePath As String > > REM The next line needs to be edited. I'm not sure why I hard coded the > > path, > > REM but I think I remember that I just couldn't find another way at the > > time being. > > REM I still would like to know, so if anyone… There should be a simple > way > > to > > REM find out the path to the current file, shouldn't it? I think there > were > > some > > REM discussions about this in this mailing list, but I don't remember if > > anyone > > REM finally figured it out… > > FilePath="/some/path/to/this/file/" > > FilePath=FilePath & ThisComponent.getTitle() > > FileUrl=ConvertToUrl(FilePath) > > FileUrl=Left(FileUrl,Len(FileUrl)-3) & "csv" > > ThisComponent.StoreToUrl(FileUrl, PropVal()) > > End Sub > > > > Sub SelectRow > > Dim Row As Integer, Sheet As Object > > Sheet=ThisComponent.Sheets.getByName("Tider") > > Row=Sheet.getCellByPosition(0,0).getValue() > > SelectFirstEmptyRow(Sheet,0,Row) > > End Sub > > > > Sub SelectFirstEmptyRow(Sheet As Object, Column As Integer,Row As > Integer) > > Dim Cell As Object > > Dim Ranges As Object > > > > Cell=Sheet.GetCellByPosition(Column,Row) > > > > SelectCell(Sheet,Column,Row) > > End Sub > > > > Function SelectCell(Sheet As Object, Column As Integer,Row As Integer) > > ' Select and highlight the cell > > > ThisComponent.CurrentController.Select(Sheet.getCellByPosition(Column,Row)) > > SelectEmptyRange > > End Function > > > > Sub SelectEmptyRange > > Dim EmptyRange > > > > > EmptyRange=ThisComponent.createInstance("com.sun.star.sheet.SheetCellRanges") > > ThisComponent.CurrentController.Select(EmptyRange) > > End Sub > > > > > > Read the REM lines above for more information… > > > > > > > > Kind regards > > > > Johnny Rosenberg > > ジョニー・ローゼンバーグ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org > For additional commands, e-mail: users-h...@openoffice.apache.org > >