Giter Club home page Giter Club logo

xlw's Introduction

dev master prerelease release
Build Nuget Build Nuget Build Nuget Build Nuget

This project is looking for developers to maintain and take the project forward

Using CI builds

To use CI builds add the following nuget feed:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <clear />
        <add key="XLW" value="https://f.feedz.io/xlw/xlw/nuget/index.json" />
        <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
    </packageSources>
</configuration>

XLW

XLW aims to facilitate the development of Excel addins with ease. It attempts to do this by wrapping the old Excel XLL C API in essentially a facade which is simplier to consume hence leaving the developer to focus on the buisness logic. To this end it hides away intricacies of interfacing with the low level Excel C API.

The concept behind XLW's approach is simplicity. There is nothing clever here !

C++

  • You write your C++ functions
  • The interface genertor generates the Excel C API bindings from your C++ header files.

C#

  • You write your C# functions
  • The Dotnet Interface generator uses reflection to generate C++/CLI bindings for your C#
  • The (C++) interface genertor generates the Excel C API bindings from your C++/CLI header files

It's really not more complicated than that. Moreover, the process should be very transparent and the entry cost for any developer to modify, update or fix XLW should be extremely low.

xlw is being updated.

This repo was originally forked from John's XLW repo which itself was imported from it's original home at SourceForge

This version will only support Visual Studio 2020 for now. Support for all previous Visual Studio versions has been dropped. All support for gcc has also been dropped.

Support is being added for building xlls against .NET 6 & .NET Framework 4.7.2

An initial dev nuget package for building C/C++ xlls is avaialable at xlw@nuget.
And a nuget package for building C# xlls is available at xlwDotNet@nuget.


xlw

xlw for building C++/C xlls has not changed much at this point. To build a C++ xll :

  1. Create an empty C++ DLL project.
  2. Add the xlw nuget package.

*Required MSVC Toolset v143

Creating a C++ XLL for Excel with XLW

Creating a C++ XLL for Excel with XLW


xlwDotNet

Only VS2020 is supported right now. To build a C# xll :

  1. Create a new .NET Core library project.
  2. Open the .csproj file with a text editor and set the TargetFramework and Platform for example
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net6.0</TargetFrameworks>
    <Platforms>x64</Platforms>
  </PropertyGroup>
</Project>
  1. Add the xlwDotNet nuget package.

Creating a C# XLL for Excel with XLW

Creating a C# XLL for Excel with XLW

... And Just Because We Can

Embedding ASP.NET Core (kestrel) in an xll

XLL with Embedded ASP.NET Core (Kestrel) - Built with XLW against .NET 5 Preview

xlw's People

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

Watchers

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

xlw's Issues

How use it in C#

How is referenced in csharp or is only valid in C++? The syntax is idem to before versions?

XLW Dependencies

Hello people,

I made an xlw addin with Visual Studio 2010 (old version), and now, 2019, but I always have a problem: the compiled addin does not work on computers without VS installed.
After a lot of research, I found in this latest version (VS 2019), a debugger that told me what dependencies the addin was using, listed below:

MSVCP140D.dll
VCRUNTIME140_1D.dll
VCRUNTIME140D.dll
ucrtbased.dll

I need to know how to compile the addin without these dependencies, export them, or which program to install on other computers to run (other than Visual Studio).

Can you help me please ?

natvis file for Visual Studio MyMatrix

Has anybody got, perhaps, a natvis file for visual studio for MyMatrix ( NCMatrix and NEMatrix are perhaps the same). I've tried a number of approaches for MyMatrix and NCMatrix but no luck. A natvis for XLfOper would be nice but I imagine that would be complex. MyArray is visible in the debugger, and for the libraries Boost, Eigen and std there are natvis files available for their matrices.

natvis seems very poorly documented.

Dan

Good stuff!

This should probably go in your wiki but I wasn't able to post there.
I have created a web version of Macrofun.hlp.
Hope you find that useful.

Question about VS2017

I know that the docs state that only VS2019 is supported. However, I need to build a plugin that complies with VS2017.

How likely is this to work (will it probably work?)

If not, what would an alternative be?

MyMatrix is not working well

The Pre Release xlwDotNet is working fine using Framework 5.0, but when we use MyMatrix, to do some operations, the function not return all values

Visual Studio 2022, it can be used to compile XLW. notes

As info:
After a few days of work I have now got both xlw v4.0 r151 as well as the newer version from 2020 to compile in Visual Studio 2022 community edition, also using the language ISO C++20, based on my xlw v4.0 r151 version for VS17 (see issue #13) which was using the default language ISO C++14. ( I have skipped VS2019)
I have generated both 32 and 64 bit version of the xlw library, the xllcall32.dll, the interface generator, and xlwDocGen
As well as a xll library that also uses Boost v1.78.

For xlw v4.0 r151 the files xlwshared_ptr_details.h and xlwshared_ptr.h must have the texts "auto_ptr" changed to "unique_ptr", since auto_ptr has been deprecated in C++17. These two files don't exist in the 2020 version of xlw

Also xlfExcel.cpp line 141 , add "(unsigned)" in front of ret.val, however this just stops the compiler giving a warning
For the newer version of xlw from 2020, xflExcel.cpp line 135 col 66 add "(unsigned short)"

A warning (that generates loads of other warnings) came up that only started with the VS2022 even with C++14. It is from MJcellmatrix.cpp line 159 for both v4.0 r151 as well as the xlw version from 2020. Some sort of casting needs to be done to convert std::str and wstr I think. I can't figure out exactly what needs changing in the ValueAsString.reset assignment.

Lots of warnings come when code analysis is carried out, a ton of C26451 (casting) warnings.

It is not clear what changes have been made in the xlw 2020 version, so I will continue with v4.0 r151 initially and VS17
But I now know that I can easily migrate to VS22, I have to test more

maybe this info helps somebody

Sourceforge revision, r1483, why not r1551 ?

Is nothing "lost" by reverting to r1483 ?

The version ported over from sourceforge appears to be from Nov 29 2015, r1483.

The latest trunk in sourceforge is r1551, and the minor revision in the branch DEV6 r1552 with the extra include line for XlfException.h is perhaps of importance for some.

In January 2020 I compiled r1551 in VS2107 professional creating 32 and 64 bit libraries, and everything works as in VS2012, just had to remove a deprecated compile option switch (/Gm) in VS2017 and change line 141 in xlfExcel.cpp adding "(unsigned) prior to "ret,val.w" to avoid the C4838 warning,

xlDocGen ( in the debug configuration remove /SAFESEH option since it makes no sense. /SAFESH can be kept in the release version.

It is great the XLW project is active again.

can't build XLL using C# with VS19 community edition

I'm not able to build the project.

I wanted to try out xlw and was following the xlwDotNet video using VS2019 Community Edition, but I never got a successful build (Error output below)

From what I can figure out ...
It fails trying to generate the XLL, and that may be due to an issue with the path.
I've found a suggestion saying that it could be fixed in the project's Pre-Build Event settings, but that feature doesn't appear to be part of the community edition of VS 2019.

I noticed a double backslash in the error output just before the DLL filename, and that doesn't seem consistent.

thanks

Severity Code Description Project File Line Suppression State Error MSB3073 The command "C:\Users\posta\.nuget\packages\xlwdotnet\20.8.16-devd0cc\build\..\mixed\lib\x64\Debug\netcoreapp3.1\DotNetInterfaceGenerator.exe bin\x64\Debug\netcoreapp3.1\\xlw_test_1.dll xlw_test_1 _xlwAutoGeneratedSource DLL" exited with code -532462766. xlw_test_1 C:\Users\posta\.nuget\packages\xlwdotnet\20.8.16-devd0cc\build\xlwDotNet.targets 22

[help needed]How to return an object to Excel using xlw?

Hi, I am currently using xlw to develop my own quant addins. It is a really a great library, and much easier to use than other tools like xlladdins.

But as some exotic options need a lot of inputs, it is much better if we can return those as object to excel and then use that object as input to the downstream fomulas.

I've been searching for documentations but unfortunately found none related to this.

Does anyone know how to return objects to excel by xlw?

Thanks.

InterfaceGenerator and #include "..\<inputFileName>.h"

Hello.

Commit c7ff826 on July 20 2020 changes the way that the generated cpp file includes the header file from which it was generated.

Say I created my addin functions in AddinFuncs.h. The generated file (say xlwAddinFuncs.cpp) now has this:
#include "..\AddinFuncs.h"

Before this commit, it had:
#include "AddinFuncs.h"

This change forces me to generate the cpp file in a sub-directory of the directory containing AddinFuncs.h. I don't think that it should make this decision; what if I want my build system to place all generated files (i.e. object files and source files) in a different location?

I should have the freedom to do that, and to configure my include directories so that the compiler finds AddinFuncs.h.

I propose that this change be reverted to the previous behaviour.

Regards

Tony

Compilation don't work with space in project path

Hi,

When I try to build the famous project in video Tutoriel :

MyMatrix // transposed matrix
MyTranspose(MyMatrix input);

Compilation don't work with code 9009. Because project is located in path with space. For example C:\Users\FirstName LestName\Documents\Visual Studio\repos\ExcelAddin1

And It works fine with path without space.

xlw version 20.8.16-DEVd0cc

Visual Studio : Community Microsoft Visual Studio Community 2022
Version 17.2.6
VisualStudio.17.Release/17.2.6+32630.192
Microsoft .NET Framework
Version 4.8.04084
Version installée : Community
Visual C++ 2022 00482-90000-00000-AA344
Microsoft Visual C++ 2022

Menu commands are not in the same order as declaration

std::map is used to store menu commands but in the Excel menu menu commands are not in the same order as in the declaration (xlAutoOpen).
Please use std::vector instead of std::map.
Correction is available in "dev_ylaroye" fork

Question about design of CellValue and CellMatrix

Hi, long time xlw user here, happy to see the project in github.

My question is twofold:

  1. why is CellValue a virtual base class? Is anyone out there actually using something different than MJCellValue?
  2. why does CellMatrix use pimpl and why is CellMatrix_pimpl_abstract a virtual base class? Again, is anyone using something different that MJCellMatrix?

It seems to me the design would be much simpler if we just had everything concrete, no polymorphism and no pimpl. Also, everybody is paying for the possibility of having their own implementation, when I don't see much value to do that.

TLDR; my objective would be to add move semantics to CellMatrix and CellValue, and that would be much easier if those were plain value-based classes.

Error C1047 when building Release x64

Recently installed MSVS 2019, simple "test" xll creation , works fine for debug and win32 releases, but won't link the release/x64 build:
fatal error C1047: The object or library file 'C:\Users...\packages\xlw.20.8.16-DEVd0cc\build..\native\lib\x64\xlw-vc142-mt-20_08_16.lib' was created by a different version of the compiler than other objects like 'x64\Release\Black.obj'; rebuild all objects and libraries with the same compiler.

If this matters:
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29335 for x64

CellMatrix[i, j].StringValue() - return garbage

then i look at the content of M[i, j].StringValue() in Debugger - it show some garbage instead of text, what did i do wrong?
//M is CellMatrix

my code below:

    [ExcelExport("test1")]
    public static MyMatrix mytest1(
            [Parameter("text")] string s,
            [Parameter("text matrix")] CellMatrix M)
    {
        var result = new MyMatrix(M.RowsInStructure, M.ColumnsInStructure);
        for (int i = 0; i < M.RowsInStructure; i++)
        {
            for (int j = 0; j < M.ColumnsInStructure; j++)
            {
                if (M[i, j].IsAString)
                {
                    result[i, j] =s.Length + M[i, j].StringValue().Length;
                }
                else
                {
                    result[i, j] = 10000; //s.Length;
                }
            }
        }
        return result; 
    }

Error (active) E0323 function returning abstract class "xlw::CellValue" is not allowed

CellValue GetCellValue(const unsigned long i, const CellMatrix &cm) {
int cols = cm.ColumnsInStructure();
unsigned long r = (i / cols);
unsigned long c = (i % cols);
CellValue cv = cm(r,c);
return cv;
}

I am getting the "Error (active) E0323 function returning abstract class "xlw::CellValue" is not allowed" on the first line.

I am converting my old (very large) project from XLW4 (VS2008) to VS2019. The project was compiling and perfectly under the old version but am now getting a lot of compile errors.

CellValue seems to be an abstract class so I am trying to figure out if should be using another implemented class instead or if I should be implementing this myself.

Also, same question on CellMatrix (as I do see MJCellMatrix also)

Any help is appreciated.

request help

Thanks your share. I have a problem, I want to implement the following function.

void count()
{
MyMatrix data(4,4);
int k=0;
while (true)
{
for (size_t i=0; i < 4; i++)
{
for (size_t j=0;j<4;j++)
{
data[i][j] = k+i+j;
}
}
SetContent(data);
}
}

I have called ‘SetContent’ function, excel cell prompt error code 2.
My target is that data is updated in real time. My excel version is
Microsoft office 365.
I hope you can help.

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.