npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xvba-com

v1.0.5-b

Published

Create a Windows COM like ExcelXvba (excel-xvba)

Downloads

23

Readme

XvbaCom

  • Create Windows COM like Excel for use in Node Js

  • It's a Framework where you extends your class and use the methods for conect to Windows COM

  • You can pass multi params to methods (strings | numbers | booleans)

See ExcelXvba (Windows COM) created with this extension

  • ExcelXvba

If you want to edit vba on VSCode see XVBA:

  • www.xvba.dev

Importing


import { XvbaCOM } from "xvba-com";

//Just extends Your COM class 
export class Excel extends XvbaCOM {

    constructor() {
    super("Excel.Application");
  }

}

Example from ExcelXvba:


import { XvbaCOM } from "xvba-com";
import { Sheets } from "./Sheets";
import { WorkBooks } from "./WorkBooks";

export class Excel extends XvbaCOM {
  public WorkBooks: WorkBooks;
  private _Sheets: Sheets;

  public get Sheets(): Sheets {
    if (this._Sheets == undefined) {
      this._Sheets = this.CreateObject(Sheets);
      return this._Sheets;
    } else {
      return this._Sheets;
    }
  }

  constructor() {
    super("Excel.Application");
    this.WorkBooks = new WorkBooks();
  }

  Visible = () => this.SetBooleanValue("Visible", true);

  Name = () => this.GetStrValue("Name");

  Quit = () => this.CallMethodToGetVoid("Quit");
}

Webpack Config

  • Put this package in the externals option in webpack.config

  externals: {'xvba-com': 'xvba-com'}
  

List of Methods from this Frameworks:


  /**
     * Call to a COM Method that returns a XvbaCom Object
     *
     * @param propToCall:<string> Method Name
     * @param args : arguments is an Array-like object <string | number | boolean >
     * @returns XvbaCom
     */
    protected CallMethodToGetObject(propToCall: string, XCom: XvbaCom, ...args: any): Object<XvbaCom>;

    /**
     * Call to a COM Method that returns a String value
     *
     * @param propToCall:<string> Method Name
     * @param args : arguments is an Array-like object <string | number | boolean >
     * @returns string
     */
    protected CallMethodToGetString(propToCall: string, ...args: any): string;
    
    /**
     * Call to a COM Method that return void
     *
     * @param propToCall:<string> Method Name
     * @param args : arguments is an Array-like object <string | number | boolean >
     */
    protected CallMethodToGetVoid(propToCall: string, ...param: any): void;

    /**
     * Call to a COM Method that returns a Number Value
     *
     * @param propToCall:<string> Method Name
     * @param args : arguments is an Array-like object <string | number | boolean >
     * @returns number
     */
    protected CallMethodToGetNumber(propToCall: string, ...args: any): number;

    /**
     * Get COM property/Object by name
     *
     * @param prop <string> the COM property Name
     * @returns
     */
    protected GetPropByRef(prop: string): any;

    /**
     * Create COM object
     * @param XvbaCom <XvbaCom>
     * @param args : arguments is an Array-like object <string | number | boolean >
     * @returns <XvbaCom>
     */
    protected CreateObject(XvbaCom: XvbaCom, ...args: any): Object<any>;

    /**
     * Get COM number Property value by
     * pass COM property name
     *
     * @param prop <string> COM Property name
     * @param args : arguments is an Array-like object <string | number | boolean >
     * @returns
     */
    protected GetNumbValue(prop: string, ...args: any): number;

    /**
     * Get COM string Property value
     *
     * @param prop <string> COM Property name
     * @param args : arguments is an Array-like object <string | number | boolean >
     * @returns
     */
    protected GetStrValue(prop: string, ...args: any): string;

    /**
     *
     * Set String Value to COM Property
     *
     * @param propToCall <string> COM Property name
     * @param value string value to set to the property
     * @returns void
     */
    protected SetStrValue(propToCall: string, value: string): void;

    /**
     *
     * Set Number Value to COM Property
     *
     * @param propToCall <string> COM Property name
     * @param value string value to set to the property
     * @returns void
     */
    protected SetNumbValue(propToCall: string, value: number): void;

    /**
     *
     * Set Boolean Value to COM Property
     *
     * @param propToCall <string> COM Property name
     * @param value string value to set to the property
     * @returns void
     */
    protected SetBooleanValue(propToCall: string, value: Boolean): void;
    /**
     * Check the param type receive from  functions and return a number
     * correspond to the type in C++
     * @param value
     * @returns
     */

 /**
     * List of all COM objects create in C++
     * @returns
     */
    static ListGUID(): IGuid[];

    /**
     * Release all COM
     *
     * C++ has no garbage collection and
     * has to manually managed memory allocation/deallocation
     *
     */
    static ReleaseAllCOM(): void;

    /**
     * Release all COM With Delay
     *
     * C++ has no garbage collection and
     * has to manually managed memory allocation/deallocation
     * Some cases the delay on Release COMs is needed
     *
     * @param time: number default = 3000ms
     */
    static ReleaseAllCOMWithDelay(time?: number): void;

    /**
     * Release all COM
     *
     * C++ has no garbage collection and
     * has to manually managed memory allocation/deallocation
     * @param className
     */
    static ReleaseSelectedCom(className?: string): void;

    /**
     * Release all COM
     *
     * C++ has no garbage collection and
     * has to manually managed memory allocation/deallocation
     * @param className
     */
    ReleaseCOM(): void;

Contributions

  • Contributions are very welcome!