@jspreadsheet/copypaste_advanced

3.3.1 • Public • Published

jSpreadsheet Plugin : Copy Paste Advanced

The Copypaste_advanced plugin improves the copy paste functionality of jSpreadsheet. It works even if access to the clipboard is denied or in error.

preview

This plugin is Free

Features

  • Add items cut, copy, paste on default toolbar
  • Add item paste on default context menu when it is not present
  • Upgrade copy/paste of jSpreadsheet when clipboard access is denied
  • Override copy methods of jSpreadsheet
  • Can copy scale like Excel
  • Work on Mobile
  • Paste data from Excel (with or without style)
  • Add items on topmenu bar (plugin) where you want with position property
  • NEW : Multiple select cells with Ctrl pressed, copy this multiple cells and paste

What is jSpreadsheet ?

jSpreadsheet, a lightweight Vanilla JavaScript plugin, can help you create exceptional web-based interactive tables and spreadsheets. Compatible with most widely-used spreadsheet software, such as Excel or Google Spreadsheet, it offers users an unrivalled Excel-like user experience. It also works well with prominent modern frameworks and flexibly utilizes a large collection of events, extensions and configurations to meet different application requirements. Impress your clients with a better user experience and a great dynamic interactive data management tool.

Documentation

Dependencies

Options of plugin

Option name Description Type Default Value
allow_pastestyle Allow paste style on copy/paste Boolean true
position_toolbar Define position in toolbar (null: default behavior, found first divisor and add after, false: not add, int: add specific position int/null/false null

For translation

you can use jSuites dictionary for translate this plugin

Option name Default Value
text_paste_special Paste special
text_paste_only_style Paste only format
text_paste_only_value Paste only value

Methods of plugin

Method Description Example
copy(*Optional* Boolean cut) → Array Copy selected cells. If copy(true), you cut selected cell. This methods return same result of jspreadsheet.current.copy(). jspreadsheet.current.plugins.copypaste_adv.copy();
paste(*Optional* Boolean OnlyValue) → Void paste data copied on selected cell jspreadsheet.current.plugins.copypaste_adv.paste();

Get started

Header on page

<script src="https://cdn.jsdelivr.net/npm/jspreadsheet/dist/index.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jspreadsheet/dist/jspreadsheet.min.css" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/jsuites/dist/jsuites.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsuites/dist/jsuites.min.css" type="text/css" />

<script src="/path/to/copypaste_advanced.min.js"></script>

Initialize plugin on jSpreadsheet

jspreadsheet(document.getElementById('spreadsheet'), {
	...
	plugins: [
      ...
      { name:'copypaste_adv', plugin:jss_copypaste_advanced},
      ...  
    ],
    ...
});

Example of code for custom toolbar

jspreadsheet(document.getElementById('spreadsheet'), {
	...
	toolbar: [
      ...
        {
	        content: 'content_cut',
	        onclick: function() {
	            if (jspreadsheet.current.selectedCell) {
	                jspreadsheet.current.copy(true);
	            }
	        }
	    },
	    {
	        content: 'content_copy',
	        onclick: function() {
	            if (jspreadsheet.current.selectedCell) {
	                jspreadsheet.current.copy();
	            }
	        }
	    },
	    {
	        content: 'content_paste',
	        onclick: function() {
	            if (jspreadsheet.current.selectedCell) {
	                jspreadsheet.current.parent.plugins.copypaste_adv.paste();
	            }
	        }
	    },
      ...  
    ],
    ...
});

CDN

You can use this CDN link

<script src="https://cdn.jsdelivr.net/gh/GBonnaire/jspreadsheet-plugins-and-editors@latest/plugins/JSSV8/dist/copypaste_advanced.min.js"></script>

NPM

npm install @jspreadsheet/copypaste_advanced

import jss_copypaste_advanced from  '@jspreadsheet/copypaste_advanced';

Copyright and license

Copyright GBonnaire.fr and Code released under the MIT License

Package Sidebar

Install

npm i @jspreadsheet/copypaste_advanced

Weekly Downloads

129

Version

3.3.1

License

none

Unpacked Size

68.8 kB

Total Files

4

Last publish

Collaborators

  • nicolasjesse
  • guillaumebonnaire
  • hodeware