I have a need to present my users with an Image Picker from within the Spreadsheet Ribbon control allowing them to make "Rubber Stamp" notations on the worksheet.
The behavior would be very similar to the manner in which Charts are selected, but will instead be predefined images that represent tasks or required actions:
such as "Signature Required", "Please Review" to that effect.
Can you please provide some guidance to achieving that goal?
Thank You
Don
<ej:Spreadsheet ID="Spreadsheet1" runat="server"> <ClientSideEvents LoadComplete="loadComplete" /> <ScrollSettings Width="100%" Height="570" /> </ej:Spreadsheet> |
function loadComplete(args) { var xlFormat = this.XLFormat, images = ["Signature", "Review"]; if (!this.isImport) { this.setWidthToColumns([120, 125, 110, 130, 160, 112]); xlFormat.format({ "style": { "font-weight": "bold" } }, "A1:F1"); var ribbonGrp = { alignType: ej.Ribbon.AlignType.Rows, text: "Image Picker", content: [{ groups: [{ id: "imgPic", dropdownSettings: { dataSource: images, watermarkText: "Select a Image", width: 150, change: "onChange" } }], defaults: { type: ej.Ribbon.Type.DropDownList } }] }; this.XLRibbon.addTabGroup(6, ribbonGrp, 5); // To add the tab group in the ribbon. $("#Spreadsheet1_Ribbon").ejRibbon({ "selectedItemIndex": 6 }); this.XLRibbon.updateRibbonIcons(); } } function onChange(args) { var xlObj = $("#Spreadsheet1").data("ejSpreadsheet"), xlShape = xlObj.XLShape, pictureId = "Spreadsheet1_picture1"; switch (args.text) { case "Signature": xlShape.setPicture("A1", "/Images/Signature.png", 280, 160); break; case "Review": if ($("#" + pictureId).length > 0) xlShape.changePicture(pictureId, "/Images/PleaseReview.png"); break; } } |
yes, this worked great ( no surprise) but now I have a new issue - my Save routine isn't persisting the image.
Do I need to modify my Save method to look for (inserted) images?
Thank you for the links to the API guide.
Information on the ribbon is hard to find specific to the Spreadsheet.
Is the ribbon control the same as the stand-alone control or is it custom to the Spreadsheet control?
Many Thanks !
<input type="button" value="Save" onclick="saveJSON()" /> <input type="button" value="Load" onclick="loadJSON()" /> <script type="text/javascript"> function saveJSON() { var json = $("#Spreadsheet1").data("ejSpreadsheet").saveAsJSON(); localStorage.setItem("spread_json", JSON.stringify(json)); alert("Spreadsheet data saved!!!"); } function loadJSON() { var json = JSON.parse(localStorage.getItem("spread_json")); $("#Spreadsheet1").data("ejSpreadsheet").loadFromJSON(json); } </script> |
re: SaveAs
I need to be able to save this in native Excel format .xls/.xlsx with the images please.
re: Ribbon Control
The documentation you have shows declarative markup for the Ribbon items.
When used with the Spreadsheet it seems the only way to manipulate it is using the JS API.
Is this correct?
Thank You
Understood.
Thank You