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

exportdatafile

v1.0.6

Published

Export Data Excel Pdf and Txt

Downloads

25

Readme

Modul ExportDataFile Modul ini memfasilitasi ekspor data ke format Excel PDF dan TXT. Ini mencakup fungsi, ExportDataFile, yang dapat dikonfigurasi untuk menghasilkan laporan berdasarkan data dan konfigurasi kolom yang diberikan. Berikut adalah panduan rinci tentang cara menggunakan modul ini.

Instalasi Untuk menggunakan modul ExportDataFile, Anda perlu menginstalnya di proyek Anda. Anda dapat melakukannya menggunakan npm:

Example Demo

Install

npm install exportdatafile

Fitur

  • Download File .xlsx .txt .pdf format
  • Tidak ada kode sisi server
  • Mudah digunakan
import { ColumnGenarator, ExportDataFile } from "exportdatafile";

const DemoPage = () => {
  interface FakturHutang {
    no_faktur_hutang: string;
    tgl_system: string;
    harga: number;
    berat: number;
    total: number;
    diskon: string;
    input_by: string;
  }
  const data: FakturHutang[] = [
    {
      no_faktur_hutang: "001",
      diskon: "rp",
      tgl_system: "2022-01-01",
      harga: 10000,
      berat: 2,
      total: 20000,
      input_by: "Samsul"
    },
    {
      no_faktur_hutang: "002",
      diskon: "rp",
      tgl_system: "2022-01-01",
      harga: 10000,
      berat: 2,
      total: 20000,
      input_by: "Samsul"
    }
  ];

  const columns: ColumnGenarator<FakturHutang>[] = [
    {
      label: "Tanngal",
      key: "tgl_system"
    },

    {
      label: "Diskon",
      key: "diskon",
      options: {
        halign: "center"
      }
    },
    {
      label: "Harga",
      key: "harga",
      options: {
        format: "RP"
      }
    },
    {
      label: "Berat",
      key: "berat",
      options: {
        format: "GR"
      }
    },

    {
      label: "Total",
      key: "total",
      options: {
        format: "RP"
      }
    }
  ];
  return (
    <div>
      <button
        onClick={() =>
          ExportDataFile({
            type: "TXT",
            date: {
              start_date: "11-01-2024",
              end_date: "11-01-2024"
            },
            data: data,
            columns: columns,
            grouping: [],
            excelSetting: {
              titleExcel: "Example Export Data Excel",
              bgColor: "000000",
              txtColor: "ffffff",
              grandTotalSetting: {
                colSpan: 2
              }
            },
            txtSetting: {
              dataTxt: data,
              titleTxt: "Example Export Data Txt",
              templateTxt: `--------------- SLIP ---------------\nFaktur         = {no_faktur_hutang}\nDiskon         = {diskon}\nTanggal System = {tgl_system}\nHarga          = {harga}\nBerat          = {berat}\nTotal          = {total}\nInput_by       = {input_by}`
            },
            pdfSetting: {
              titlePdf: "Example Export Data Pdf",
              orientation: "l",
              unit: "mm",
              bgColor: "000000",
              txtColor: "ffffff",
              theme: "grid",
              grandTotalSetting: {
                colSpan: 2
              },
              openNewTab: true
            }
          })
        }
      >
        Export Laporan
      </button>
    </div>
  );
};

export default DemoPage;

Option Daftar properti yang tersedia dapat ditemukan di bawah. Ini harus diteruskan ke komponen ExportDataFile.

| Properti | Tipe | Deskripsi | | -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type | String | Tipe data ekspor, menentukan format file yang akan diekspor. Nilai contoh: "TXT", "PDF", "EXCEL", "ALL" (untuk mengekspor semua file data). | | date | Object | Objek dengan properti start_date dan end_date yang menentukan rentang tanggal untuk ekspor data. Format: "DD-MM-YYYY". | | data | Array | Data yang akan diekspor. Jika ingin menggunakan pengelompokan (grouping), berikan detail dalam penggunaannya di dalam array. Setiap elemen array mewakili kolom atau properti berdasarkan mana data akan dikelompokkan. | | columns | Array | Kolom-kolom data yang akan diekspor. Setiap elemen array merupakan objek dengan properti berikut: | | | | - key: Kunci yang merujuk pada properti data yang akan ditampilkan dalam kolom. | | | | - label (opsional): Label atau nama yang akan ditampilkan di header kolom. | | | | - options (opsional): Objek yang berisi pengaturan tambahan untuk kolom, seperti: | | | | - format (opsional): Tipe format untuk data dalam kolom (misalnya, tipe tanggal atau angka). | | | | - halign (opsional): Penyelarasan horizontal untuk data dalam kolom. | | | | - disabledColumn (opsional): Jika true, kolom akan dinonaktifkan dalam data yang diekspor. | | | | - disabledFooter (opsional): Jika true, kolom akan dinonaktifkan dalam bagian footer (grand total).
| grouping | Array | Array yang menentukan pengaturan pengelompokan untuk data yang diekspor. contoh [no_faktur] | | excelSetting | Object | Pengaturan khusus untuk ekspor Excel, termasuk titleExcel, bgColor, txtColor, dan grandTotalSetting dengan colSpan. | | txtSetting | Object | Pengaturan khusus untuk ekspor TXT, termasuk dataTxt, titleTxt, dan templateTxt yang berisi template untuk file TXT dengan placeholder. | | pdfSetting | Object | Pengaturan khusus untuk ekspor PDF, termasuk titlePdf, orientation, unit, bgColor, txtColor, theme, grandTotalSetting dengan colSpan, dan openNewTab untuk membuka PDF di tab baru (boolean). | | openNewTab | Boolean | Jika true, membuka file PDF yang diekspor di tab baru. |