RSSheet icon indicating copy to clipboard operation
RSSheet copied to clipboard

excel sheet with xml data

Open ourdex86 opened this issue 12 years ago • 8 comments

Hi,

This is Bharath.

When I use this RSSheet library into my application, it is saving in .xls format bu when I open it, Its showing complete xml string not .xls

I have used the following code

RSworkBook * folder = [ [RSworkBook alloc] init]; folder.author = @"andrea cappellotto"; folder.version = 1.2;

RSworkSheet * sheet = [[RSworkSheet alloc] initWithName:@"prova"];

RSworkSheetRow * row = [[RSworkSheetRow alloc] initWithHeight:20]; [row addCellString:@"prova"]; [row addCellString:@"prova2"]; [sheet addWorkSheetRow:row];

RSworkSheetRow * row2 = [[RSworkSheetRow alloc] initWithHeight:25]; [row2 addCellNumber:100]; [row2 addCellData:[NSDate date] ]; [sheet addWorkSheetRow:row2];

[folder addWorkSheet:sheet];

NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [documentPaths objectAtIndex:0]; [folder writeWithName:@"prova" toPath:documentsDir];

Could you please tel me what should I do? I am not getting proper excel sheet

ourdex86 avatar Apr 27 '12 06:04 ourdex86

Did you resolve this problem?

jerryga avatar Feb 08 '14 07:02 jerryga

Same here, if anyone had resolved this please let us know the solution for same

vijaydogra avatar Apr 18 '14 07:04 vijaydogra

Did anyone find a solution for this?

subhamkhandelwal avatar Mar 01 '15 10:03 subhamkhandelwal

Same here :(

xnth97 avatar May 14 '15 13:05 xnth97

Some of the XML header data needs to be updated. I replaced line 60 os RSworkBook.m (in the writeWithName function) with the following and it corrected the problem for me:

NSString * head = [[NSString alloc] initWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<?mso-application progid=\"Excel.Sheet\"?>\n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\"\n xmlns:x2=\"http://schemas.microsoft.com/office/excel/2003/xml\"\n xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"\n xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n xmlns:html=\"http://www.w3.org/TR/REC-html40\"\n xmlns:c=\"urn:schemas-microsoft-com:office:component:spreadsheet\">\n<DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\"><Author>%@</Author>\n<LastAuthor>%@</LastAuthor>\n<Created>%@</Created>\n<Version>%.2f</Version>\n</DocumentProperties>\n", self.author, self.author, dateString, self.version];

I will try to create a pull request with the fixed code when i get a chance. Good luck!

timharter avatar Sep 05 '16 18:09 timharter

by any chance someone got it to work? @timharter the header you provided yields the same results. it just appears as a string.

nimrodbens avatar Feb 11 '20 23:02 nimrodbens

Hi guys, sorry for the long time, but i changed my work in this years.. Now that i return to develop on iOS i try to update the library

andreac avatar Feb 12 '20 11:02 andreac

thanks a lot for answering :)

nimrodbens avatar Feb 13 '20 11:02 nimrodbens