Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excel sheet with xml data #2

Open
ourdex86 opened this issue Apr 27, 2012 · 8 comments
Open

excel sheet with xml data #2

ourdex86 opened this issue Apr 27, 2012 · 8 comments

Comments

@ourdex86
Copy link

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

@jerryga
Copy link

jerryga commented Feb 8, 2014

Did you resolve this problem?

@vijaydogra
Copy link

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

@subhamkhandelwal
Copy link

Did anyone find a solution for this?

@xnth97
Copy link

xnth97 commented May 14, 2015

Same here :(

@timharter
Copy link

timharter commented Sep 5, 2016

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!

@nimrodbens
Copy link

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

@andreac
Copy link
Owner

andreac commented Feb 12, 2020

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

@nimrodbens
Copy link

thanks a lot for answering :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants