I'm writing an iphone application that pulls xlsx file from the server, manipulates with it (reading and writing to it) and upload it to the server. So I need to convert it to plist format, do some operations with plist and convert plist back to xlsx and upload it to server.
How the convertion xlsx->plist and plist->xlsx could be done on ios?
Here's what you will need to achieve your task:
Note: You must do the heavy lifting
To parse an xlsx, you will need to understand the Open XML file formats: Link
To parse a plist, you will need to understand the Property List file format: Link
To parse, I recommend using the NSXMLParser: Link
Related
I want to encode locally and upload to avoid spending money in encoding.
Is this allowed? I did not find any documentation on it.
When I simply uploaded a file to the storage, the media services account said it could not play it without the ISM file. I had to encode (was it re-encode? it was an mp4) the file I had uploaded - I want to avoid that.
Yes, absolutely allowed and encouraged for customers. Especially ones that have custom encoding requirements that we may not support.
You can upload an .ism file that you create along with your encoded files. It's a simple SMIL 2.0 format XML file that points to the source files used.
It's a bit hard to find searching the docs, but there is a section outlining the workflow here - https://learn.microsoft.com/en-us/azure/media-services/latest/encode-dynamic-packaging-concept#on-demand-streaming-workflow
There is also a .NET Sample showing how to do it here:
https://github.com/Azure-Samples/media-services-v3-dotnet/tree/main/Streaming/StreamExistingMp4
You can see the code line at 111 that shows how to generate the .ism file -
// Generate the Server manifest for streaming .ism file.
// This file is a simple SMIL 2.0 file format schema that includes references to the uploaded MP4 files in the XML.
var manifestsList = await AssetUtils.CreateServerManifestsAsync(client, config.ResourceGroup, config.AccountName, inputAsset, locator);
I have Excel file with table ~100x100 and need to get access to this values from iOS app.
At first, I've try to make json in Mr.DataConverter and then it's not a problem to read to array. But! Some float values didn't recognized properly, and I'd got numbers without quotes:
At the time other parsed correctly!
So, from this moment I can't parse my Json string to NSArray.
The question is:
How to convert xls to json, OR How to put and retrieve the values in iOS device?
Thanks.
You can use the DHlibxls iOS Framework and simply pull the .xls file into your app, then read and process with that framework. The framework is based on the open source libxls library on SourceForge, and has a non-attributed BSD license.
I recommend exporting the Excel spreadsheet to CSV and then using a proper CSV parser to parse the data. If you run into any issues then there is likely an issue in the spreadsheet that you would need to fix.
Alternative: If possible use excel file in formate: tab delimited-text-file. That solve all your problem. Easy to open text file in iOS with file manager/c++.
convert-an-excel-spreadsheet-to-a-tab-delimited-text-file
I was just wondering how I can download a .webarchive from my UIWebView using ASIHTTPRequest. I've looked at their documentation but unfortunately, it doesn't mention anything about saving web archives.
I noticed that this app saves .webarchives to the iOS device and loads them.
To quote http://en.wikipedia.org/wiki/Webarchive :
"The webarchive format is a concatenation of source files with
filenames saved in the binary plist format using NSKeyedEncoder"
As jbat100 mentions, the ASIWebPageRequest code is likely to be a useful starting point - you'll need to write code to do the saving of the files into the binary plist format yourself.
Can an iOS app read a file that has been placed on that device e.g. a CSV file.
So the idea is when you're at home you create the file with a list of items or you get emailed it etc on your PC and then you place this file (in the correct format) on the device which reads it.
Is this possible?
You can read CSV data but "place the file on the device" would have to involve a web service of some sort. There is no way to add data to an application without getting in a from a web server. But if you have a web server that can host the csv file then opening and reading it is fairly simple.
this covers most o it
Import csv data (SDK iphone)
NSString stringWithContentsOfURL:encoding:error
will take care of the rest
There is a string feature that will take each value and place it into an array:
NSArray *anArray = [yourString componentsSeparatedByString:#","];
You can parse CSV on an iOS device.
You can place a data file on an iOS device.
Beware though of CSV format details. Just splitting a string on "," is a surefire way to get failures and random errors. Have a look at http://cocoawithlove.com/2009/11/writing-parser-using-nsscanner-csv.html for a good example on how to handle CSV data.
I've personally used the example from cocoa with love to create an operation that downloads a CSV from a http location, parses and processes it and then stores the results in a Core-Data store.
But you could just as well get the CSV file on your device by using an NSURLConnection. Beware though: NSURLDownload is unavailable on iOS. Also downloading data to the device is not recommended. Apple recommends processing the data and storing the results or just getting the data as you need it.
I want to save user generated data in an XML file in the iphone. While we have NSXMLParser to parse through any xml from a url, do we have any method to create a xml file which can be stored in the app documents directory, so that i can use the parser to read the file and then display the contents back in the app.
Or using Core Data is the last resort?
Look into libxml2 and, specifically, xmlTextWriter. Lots of examples available through Google.
Look into NSCoder & NSKeyedArchiver. for example with NSDictionary, you can do:
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
it'll write out the data as a plist. plists are in XML format.