banner



How To Create Excel Sheet In Ios Swift

Demo Swift Excel Xlsx Reader Writer

Excel

This demonstration shows:

  • The Swift programming language with Apple Xcode iOS

  • How to use XlsxReaderWriter, which is an Objective-C library, to read Microsoft Excel files by using Office OpenXML.

Example code to load a spreadsheet and print a cell value:

              let              spreadsheet: BRAOfficeDocumentPackage              =              BRAOfficeDocumentPackage.open(path)              let              worksheet: BRAWorksheet              =              spreadsheet.workbook.worksheets[0]              as!              BRAWorksheet              let              cell: BRACell              =              worksheet.cellForCellReference(                "A1"              )              print(cell.stringValue())

Start

To use this demo, you can clone this repo, or you can use this README to create your own project.

If you clone this repo, then be aware that there are multiple git branches, so pick the one you want.

  • swift-4-xcode-9: Swift version 4, Xcode version 9, iOS version 11.

  • swift-3-xcode-8: Swift version 3, Xcode version 8, iOS version 10.

Create the project

Launch Xcode and create a new Xcode project.

  • Use iOS template "Single View Application" and Product Name "Demo Swift Excel Xlsx Reader Writer".

  • Help

Get XlsxReaderWriter

Get the repository, and put it in the the same folder as our demo project's xcodeproject:

git clone --depth=1 https://github.com/renebigot/XlsxReaderWriter.git

If you want to confirm you put in the in the expected place, do the command ls:

Demo Swift Excel Xlsx Reader Writer Demo Swift Excel Xlsx Reader Writer.xcodeproj Demo Swift Excel Xlsx Reader WriterTests Demo Swift Excel Xlsx Reader WriterUITests XlsxReaderWriter

Link

Add the file XlsxReaderWriter.xcodeproj to the project, within the

Add dependency:

  • Choose: Targets → Demo Swift Excel Xlsx Reader Writer
  • → Build Phases → Target Dependencies
  • Add: XslxReaderWriterXslxReaderWriter

Link binaries:

  • Choose: Targets → Demo Swift Excel XlsxReaderWriter
  • → Build Phases → Link Binaries With Libraries
  • Add: libXlsxReaderWriter.a (which is in the XlsxReaderWriter folder)
  • Add libz.tbd (which is in the standard list of Apple items). The libz.tbd is more current than the older version named libz.dylib.

Linking:

  • Choose: Targets → Demo Swift Excel Xlsx Reader Writer
  • → Build Settings → All → Linking → Other Linker Flags
  • → Debug → (+) → Any Architecture | Any SDK
  • Add: -all_load
  • → Release → (+) → Any Architecture | Any SDK
  • Add: -all_load

Search Paths:

  • Project → Demo → Build Settings → Search Paths → User Header Search Paths
  • → Debug → (+) → Any Architecture
  • Set it to: $(SRCROOT)/XlsxReaderWriter/ not $(SRCROOT)/XlsxReaderWriter/XlsxReaderWriter/.
  • Select "recursive".
  • → Release) → (+) → Any Architecture
  • Set it to: $(SRCROOT)/XlsxReaderWriter/ not $(SRCROOT)/XlsxReaderWriter/XlsxReaderWriter/.
  • Select "recursive".

Bridging Header:

  • Create a new file to Xcode (File > New > File), then see the "Source" section, and click "Header File". If an icon for "Header File" doesn't appear, then use the search box and type "Header".

  • We like the file name Bridge.h

  • Add this code:

    Related Posts

    ", numPosts: 8, titleLength: "auto", thumbnailWidth: 159, thumbnailHeight: 89, noImage: "//1.bp.blogspot.com/-aR5w9KXuWGU/XhSDNRAVuhI/AAAAAAAAHG8/dLxcaZxSgh0v85JG0mWRMQyEwqMgpL1_gCLcBGAsYHQ/w159-h89-c/no-image.jpg", containerId: "related-post-1526218625657690246", newTabLink: false, moreText: "Read More", widgetStyle: 3, callBack: function() {} };

0 Response to "How To Create Excel Sheet In Ios Swift"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel