Paint Format
Copy formatting from one cell or range and apply it to another
Overview
Basic Usage
Using the Toolbar Button
import {
SpreadsheetProvider,
CanvasGrid,
Toolbar,
ButtonPaintFormat,
} from "@rowsncolumns/spreadsheet";
import { useSpreadsheetState } from "@rowsncolumns/spreadsheet-state";
function MySpreadsheet() {
const {
activeCell,
activeSheetId,
selections,
onSavePaintFormat,
isPaintFormatActive,
// ... other hook values
} = useSpreadsheetState({
sheets,
sheetData,
onChangeSheets,
onChangeSheetData,
});
return (
<SpreadsheetProvider>
<Toolbar>
<ButtonPaintFormat
isActive={isPaintFormatActive}
onClick={() =>
onSavePaintFormat(activeSheetId, activeCell, selections)
}
/>
</Toolbar>
<CanvasGrid
sheetId={activeSheetId}
activeCell={activeCell}
selections={selections}
// ... other props
/>
</SpreadsheetProvider>
);
}How It Works
1. Copy Format (Activate Paint Format)
2. Apply Format
3. Deactivate
Programmatic Usage
What Gets Copied
What Does NOT Get Copied
Complete Example
Keyboard Shortcut
Use Cases
Consistent Table Headers
Standardizing Reports
Color Coding
Best Practices
API Reference
useSpreadsheetState Returns
Property
Type
Description
Limitations
Troubleshooting
Paint Format Not Working
Visual Feedback Not Showing
Last updated