Giter Site home page Giter Site logo

janx2 / jxls Goto Github PK

View Code? Open in Web Editor NEW
58.0 13.0 75.0 372 KB

JXLS is an ObjC++ wrapper and framework for xlslib. xlslib is a C++/C library to construct Microsoft Excel™ .xls files in code.

License: BSD 3-Clause "New" or "Revised" License

Objective-C 43.43% Ruby 2.54% Objective-C++ 39.98% C 13.15% Rich Text Format 0.90%

jxls's Introduction

JXLS

JXLS is an ObjC++ wrapper and framework for xlslib. xlslib is a C++/C library to construct Microsoft Excel™ .xls files in code.

This Framework is based on the xlslib open source project and includes it as a git submodule.

To configure this project, you should

git submodule update --init --recursive

after cloning from within your JXLS git repo.

The xlconfig.h file was produced by doing a "./bootstrap" inside the root xlslib folder - you can replace it with the same if you wish. This library has only been tested on 64-bit Intel as it uses ARC.

There is an Xcode project for building on iOS, but it is not actively maintained. If it doesn’t just work please fix and send a pull request!

Updating

If you have been using JXLS versions before 1.0, you will have to change your imports to the umbrella header used in 1.0+:

#import <JXLS/JXLS.h>

License

UNLESS OTHERWISE SPECIFIED WITHIN THE FILES OR PROJECTS, ALL SOFTWARE ON THIS SITE IS SUBJECT TO THE FOLLOWING LICENSING CONDITIONS [BSD LICENSE]:

Copyright (c) 2008-2013 David Hoerl All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

• Neither the name of David Hoerl nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Usage

You can integrate JXLS into your project via CocoaPods or manually as described below.

Add “JXLS.xcodeproj” to your project (preferably into “Frameworks” to keep things tidy).

###Xcode 4

In your target’s “Build Phases”:

  • Add Build Phase (+-button pull-down menu) > Copy Files
  • Destination: Frameworks
  • Change name to “Copy Frameworks” to keep things clean

###Xcode 5 or 6

In your target’s “Build Phases”:

  • Editor (menu) > Add Build Phase > Add Copy Files Build Phase
  • Destination: Frameworks
  • Change name to “Copy Frameworks” to keep things clean

###Both

Add “JXLS.framework” to the following build phases (via the +-buttons):

  • “Target Dependencies”
  • “Link Binary With Libraries”
  • “Copy Frameworks” (created above)

Set “Runpath Search Paths” to

@loader_path/../Frameworks

in the “Build Settings” of your target or add

LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks

to the respective .xcconfig file, if you use them.

And finally import the header in your code:

#import <JXLS/JXLS.h>

jxls's People

Contributors

dhoerl avatar janx2 avatar master-nevi avatar viktorsimko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jxls's Issues

Any text in formula dumps not properly.

Please, help me or provide some helpful link.
Because I can't use any text literals in the excel formulas.
When I trying to compose formula like "L"="M" - excel warns me
that it's corrupted:

       xlslib_core::workbook *book;
       xlslib_core::worksheet *sheet;
       //    ...assigned somewhere

        expression_node_factory_t& maker = book->GetFormulaFactory();
        expression_node_t *L = maker.text("L");
        expression_node_t *M = maker.text("M");
        expression_node_t *L_eq_M = maker.op(OP_EQ, L, M);
        sheet->formula( cri, 0, L_eq_M, false);
        //     ...the cell with such formula considered as corrupted by Excel

Thanks and regards,
Yan ;-)

Example for JXLSExtendedFormat

Would someone please share some code on how to use this method:
setCellAtRow: column: toString:withFormat:

From my understanding I can create an JXLSExtendedFormat object in order to directly set (for example) a background fill color when using the above method. But I haven´t figured out what to pass to the first argument when initializing the object:
-(instancetype)initWithExtendedFormat:(void *)xft;

Would someone shed light on this?
Thanks, Thomas

Instruction does not work?

As for me it does not work to implement it in Xcode 5. I can not add “JXLS.framework” in “Link Binary With Libraries” as the framework is not available for selection.

Problems saving output file OSX

Hello.

I've been working on using you library in one of my apps and am having a problem actually writing an output file. The worksheet looks ok and I'm able to dive into it and it has the correct number of cells, etc... but I get a (-1) result of the writeToFile method. The string looks ok to me.. anyway..

/Users/joeruth/Desktop/Simulator data/BuntSimDataPID.new

The directory exists, etc.. but I get nothing to come out. I'm kind of reduced to trying to debug your stuff to see why I'm getting a -1 return code. Any thoughts?

I'm starting to suspect permission problems. The output file is a new file and the permissions are set to only allow access to selected files.

That was it. Opened up the download directory and was able to write into it with the same file name. This is always tricky with the new permissions setups. In order to write in a directory in the system, you need to select it somehow.

How can I add image to excel sheet?

Dear @JanX2

I used your library for my application. Thanks you for your lib!

I have a chart in my report, I convert it to image but I don't know how can I put it in the sheet.
Please help me!

Regards,
Ga

Works in Debug but not as final product

Hello,

when I build&run the application in debug mode all works fine. But when I archive, save and launch the application -> it crashes. The crash reporter tells me the following (an excerpt):

"Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
Library not loaded: @rpath/JXLS.framework/Versions/A/JXLS
Referenced from: /Users/USER/Desktop/DailiesExporter.app/Contents/MacOS/DailiesExporter
Reason: image not found"

Everything is setup as described. When I look into the contents of the application, the JXLS framework is there. My app is sandboxed.

Would someone please help?
Thomas

How can I merge cells?

Hello Jan!

Thanks for your great library! I would like to merge two empty cells at the top of the spreadsheet for the title, but I can't seem to find how to do that.

I found the -(void)mergeCellsInRect:(JXLSRECT)range method in JXLSWorkSheet.h but what does the (JXLSRECT)range object refer to?

Can you please help me figure out how to do this? Thanks!

Swift PackageManager

Hey JXLS-Team,
Could you include a Package.swift File for SPM-Compatibility?

Thanks Torben

podspec needs to be updated to point to latest JXLS updates

The current pod spec points to tag 1.0 in the repository. The pod spec should be updated to point to the latest changes. I'm not an expert at podfile creation. If a 1.1 (or 1.0.1) tag was created, the pod spec could be pointed to that tag instead. There should be a way to create the pod spec, so that you could use 1.0 or 1.0.1 depending on your Podfile. However, I don't understand exactly how that is done. I thought about creating this as a pull request, but I'm not sure how I would do that since you would need to additional git tags, etc.

Thanks!

formula support

Any chance for formula support?
If not, does anyone have an example using the C++ api to create formulas in objC?

Cannot save TestJXLSiOS xls file to documents directory

Looks like it will be a great library. I am trying to test the iOS sample project provided but it seems like the file does not save when I run the project.
I have tested on both the simulator and the device. I have even searched the documents directory and the file cannot be retrieved.

I have even double checked by testing programmatically whether the file exists or not.

int fud = [workBook writeToFile:filePath];
NSString* documentdir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
NSString *tileDirectory = [documentdir stringByAppendingPathComponent:filePath];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:tileDirectory];
if(fileExists){
NSLog(@"File does exist at filepath %@", tileDirectory);
}
else{
NSLog(@"File does not exit at filePath: %@", tileDirectory);
}
NSLog(@"OK - bye! fud=%d", fud);

This keeps returning false that the file is not found.

What can I do to find the saved file, or how can I save the excel file to a directory?

I am hoping someone here can identify the problem as soon as possible. Thank you

Podspec Enhancement

Hi there. I found JXLS very useful for one of my personal projects and I wanted to return the favor by helping you create a pod spec for JXLS. This would allow for cleaner and easier project integration using the Cocoa Pods dependency manager. I've been making private pod specs for work and personal use for a while and I would be excited to contribute to your project in this manner and maybe even get my first pull request under my belt.

If you're interested, I have a first draft already committed to my fork at https://github.com/master-nevi/JXLS/commits/podspec-addition. I've tested it on both iOS and Mac OS X and it passes the Cocoa Pod's lint test.

If you were to use it, or something like it, there are a few items I would need your input on:

  1. I would need to know the version number of JXLS to define in the spec (I could only find the current version of xlsLib which doesn't appear to be active anymore).
  2. Pod specs typically define the release commit using a git commit tag. The tag is usually equal to the version number and would need to be added to the master branch. Currently I'm defining the release commit explicitly like this:
s.source       = { :git => "https://github.com/master-nevi/JXLS.git", :submodules => true, :commit => "2ff5912d9b586f86846326869af0ad0888bbaac6" }

However ideally it would look like this:

s.source       = { :git => "https://github.com/master-nevi/JXLS.git", :submodules => true, :tag => s.version.to_s }
  1. There were a series of imports in JXLSWorkbook.h which were causing build errors and appeared to be unnecessary. I've removed them in this commit: master-nevi@2ff5912
  2. There also appeared to be an extra cpp and header file in the xlslib code base called cbridge.h/.cpp. They weren't added to either sample project and I found that they caused a bunch of build errors when I tried to include them. So for now I've added an explicit exclusion of those files in the spec:
s.exclude_files = "External/xlslib/xlslib/src/xlslib/cbridge.{h,cpp}"

Thanks again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.