I'm using the excellent jsreport solution to convert html to excel using the 'html-to-excel' recipe.
Does this recipe have any options to control the worksheet options?
Like display the sheet right to left, set the sheet's name, display grid lines etc.
The html-to-excel recipe uses html-to-xlsx under the hood. According to the document, if you want to display grid lines, you could use css style to control grid line :
td {
border-style: solid;
}
you could also use text-align too. But only a little features are supported.
The default html-to-xlsx (legacy) doesn't support custom sheet names. However, if you look into the unit test, you will find that there's a better html-to-better-xlsx:
template: {
content: `
<table name="Data">
<tr>
<td data-cell-type="number">1</td>
</tr>
</table>
`,
recipe: 'html-to-better-xlsx',
engine: 'none',
baseXlsxTemplate: {
content: xlsxTemplateBuf.toString('base64')
},
htmlToXlsx: {
insertToXlsxTemplate: true
}
}
that means adding a [name] attribute to table and setting the recipe as html-to-better-xlsx should work.
The Xlsx recipe allows us to control over the Excel completely. For example, to custom the sheet name, see https://playground.jsreport.net/w/anon/BJa5OBWD-2
{{#xlsxMerge "xl/workbook.xml" "workbook.sheets[0].sheet[0]"}}
<sheet name="My Sheet Name"/>
{{/xlsxMerge}}
{{{xlsxPrint}}}
Related
This is the code I am using present, tried in many ways like used placeholder tags but nothing worked out. Help me
<kendo-grid-column field="food" title="foods">
<ng-template kendoGridFilterCellTemplate let-filter let-column="column">
<kendo-grid-string-filter-cell
[showOperators]="false"
[column]="column"
[filter]="filter">
</kendo-grid-string-filter-cell>
I tried this approach working now
Just put this piece of code in your component file
public placeHolders(){
$(".k-textbox").eq(0).attr("placeholder", "column 1");
$(".k-textbox").eq(1).attr("placeholder", "column 2");
$(".k-textbox").eq(2).attr("placeholder", "column 3");
}
There is no solution to write default placeholder in kendo-UI > kendo-grid-string-filter-cell as per my understanding.
I have the same problem with you and I cannot find an easy way to do it. The only way i can think to achieve this is below:
1) Create a Reusable Custom Filter Component from Kendo -> https://www.telerik.com/kendo-angular-ui/components/grid/filtering/reusable-filter/
2) Then add a TextArea Input as your filter input and there's the floatingLabel html element in order to use it like placeholder.
#Component({
selector: 'my-app',
template: `
<kendo-textbox-container floatingLabel="First name">
<textarea kendoTextArea></textarea>
</kendo-textbox-container>
`
I cannot find a way to do this by using the Built-In Filter Templates that Kendo UI provides.
I'm not 100% sure of your question. I'm using Vue, but here is how I am setting placeholder text when there are no records by setting the noRecords attribute.
<kendo-grid ref="gridComponent"
...
:no-records="noRecords"
...
v-on:change="rowSelected"
:sort="sortFilter">
In Vue, noRecords is a reactive data field, defined as:
data () {
return {
noRecords: {
template: '<br /><br/> Please start typing a Policy Number, Insured Name, or Address to show results <br /><br /><br />'
}
}
I'm using the "Allowed html tags" filter in Ckeditor - Drupal 8.
I want Ckeditor to keep <span> tags that have specific classes or IDs, and to remove if it has no attribute.
For example :
Keep span: <span class="apple">text sample</span>
Keep span : <span id="fruit">text sample</span>
Remove span : <span>text sample</span> -> text sample
Actually, when I configure a text format, I have this code in the allowed tags field :
<p><sup><sub><span id class="apple"><a href !href accesskey id rel target title>
It keeps <span> with IDs or wanted classes, but I cannot get rid of the unwanted <span> with no attribute.
Is there any way to solve this problem with code input?
Thanks in advance,
Emilie
So here is the custom module I wrote to make it work and to get around this major bug in CKEDITOR :
<?php
use Drupal\editor\Entity\Editor;
function MODULENAME_editor_js_settings_alter(array &$settings) {
foreach ($settings['editor']['formats'] as $name => $value) {
$settings['editor']['formats']['machine_name_of_your_text_editor_profile']
['editorSettings']['allowedContent'] =
'p sup h1 h2 h3' +
'span[!id];
span(!foo);
span(!bar);
span(!jane);
span(!doe);'
;}
}
Result : spans are totally deleted if there is no ID, or if you use a class that is not mentionned in this list (foo, bar, jane or doe). You must declare all elements you need to be displayed, because this config will overwrite all previous inputs in the ACF field.
For this solution, I was inspired by :
The ACF Custom doc : https://ckeditor.com/docs/ckeditor4/latest/examples/acfcustom.html
A tread about hook_editor_js_settings_alter : https://drupal.stackexchange.com/questions/268311/hook-editor-js-setting...
Note : Limit allowed HTML tags and correct faulty HTML filter (in /admin/config/content/formats) does not act consistently with the Ckeditor API. Only a part of the options are really implemented in this field, and uses of "!" don't work. This is why the solution provided uses "hook_editor_js_settings_alter".
function MODULENAME_editor_js_settings_alter(array &$settings) {
$formats = ['basic_html', 'full_html'];
foreach ($formats as $format) {
$settings['editor']['formats'][$format]['editorSettings']['allowedContent']['span']['attributes'] = '!class';
}
}
allowedContent is an array when loaded by Drupal. Instead of replacing it with a string, you can use the ACF rules to specify whether attributes are required. This allows the config from the UI to still apply.
I am trying to create an Advanced PDF/HTML template that will display an image using a URL that is in a custom field. The custom field is a hyperlink and the field ID is {custitem_dp_image1}. I am using the image tag and referencing the {custitem_dp_image1} field as the src but I am unable to save the template due to the following error:
java.lang.StringIndexOutOfBoundsException: String index out of range:
0 java.lang.InternalError: java.lang.StringIndexOutOfBoundsException:
String index out of range: 0
I've also tried the following code:
<#if result.custitem_dp_image1?length != 0><img src="${result.custitem_dp_image1}" style="width: 100px; height: 100px;" /> </#if>
But I received the following error when I tried to view the Advanced PDF/HTML template from a Saved Search:
The template cannot be saved due to the following errors:
org.xml.sax.SAXParseException; lineNumber: 53; columnNumber: 28; The value of attribute "src" associated with an element type "img"
must not contain the '<' character.
*The template was stored as invalid.
How can I get this to work and display the image?
The solution is to change the custom field to type = Free-Form Text and use the following freemarker code:
<#if result.custitem_dp_image1?length != 0><img src="${result.custitem_dp_image1}" style="width: 100px; height: 100px;" /> </#if>
Instead of Hyperlink use image datatype for your custom field.
You can also use a workflow to link the Hyperlink custom field to a Free-Form text field with the Store Value field checked.
Look under SuiteAnswers ID: 89195
The Hyperlink field type will return an entire HTML tag when calling for the field like this: ${result.custitem_dp_image1}
image name
So if you add it to the HTML or tag, it would break because it would look something like this:
<img src="image name">
Freemaker has functions to trim data ?keep_after and ?keep_before
So you could use this to bring just the actual URL:
result.custitem_dp_image1?keep_after('href="')?keep_before('"')
In a nutshell, everything after the href=" and everything before the ":
BUT you cant use this inside the "src" tag as it would break the HTML code. You have double quotes inside the Freemaker function and HTML would think the src tag ended at that particular location.
So to circumvent that, I'll insert the code in a variable (either global or assign) and then use just the variable in the SRC tag.
<#global custom_url = result.custitem_dp_image1?keep_after('href="')?keep_before('"')>
<img src="${custom_url}">
Oh, just my 2 cents, Users will likely want to keep the Hyperlink field type as its clickable in the User UI.
Settings table contains always one row with lot of long-caption columns.
Opening this in jqGrid grid looks ugly.
How to force jqGrid to render its edit form instead of grid ?
In edit form data can changed and saved, grid is not nessecary.
Grid caption bar is not used (caption is empty string) and top level toolbar is used.
Row is loaded from server using json call.
I tried to use Oleg answer from How to open Edit like form using custom data in jqGrid?
grid.jqGrid({
gridstate: 'hidden',
loadComplete: function() {
$("#edit_grid_top").click();
$("#lui_"+$('#grid').id).hide();
}
...
Edit form opens, but grid is still visible. How to render edit form without grid ?
This is maybe too late, but nevertheless:
You have to hide your grid programatically. My solution was (for a grid with lots of columns):
<div id="detailslistWrapper">
<table id="detailslist">
<tr> <td/> </tr>
</table>
<div id="detailspager"></div>
</div>
and after that:
$(function()
{
$("#detailslistWrapper").hide();
});
I got it to work as: $("#gview_"+gridid).hide()
I am getting the following response
<div id="weblogs">
<tr>
<td nowrap class="bl">1</td>
</tr>
<tr>
<td nowrap class="bl">2</td>
</tr>
</div>
Now I am trying to attach the rows like the following:
function _ajax(postData)
{
loadUrl = "getweblogs.asp";
$.ajax( {
url : loadUrl, // your ajax file
type : 'post',
data : postData,
success : function( resp ) {
alert($("#weblogs" , resp).html());
$('#weblogs > tbody:last').append($("#weblogs" , resp).html());
}
});
return false;
}
The replace is working fine. My problem is, that the htmls elements from the response are removed. I'm getting only 1 and 2. instead of
<tr>
<td nowrap class="bl">1</td>
</tr>
<tr>
<td nowrap class="bl">2</td>
</tr>
I don't know what am I doing wrong. Could someone give me any clue?
Thank you!
Greetings
Magda
What you're trying to do is not so clear. Is there already an element with id="weblogs" in the page? If so, why does your response have an element with the same id (not a good idea), and if not, why are you trying to append an element's contents to itself like that (also, not a good idea)?
Why not just change the server-side to send the html required, without a wrapping div tag (which makes it invalid html anyway, another bad idea), and then use it as-is?
Another problem is that you're trying to select .html() of something that will always be an empty jquery object: $(selector, string) will never match anything. You'll need to make the string a jquery object if you want to search its substructure: string = $(string).
And I think you're misunderstanding the use of $(selector, $obj). The selector must be in the $obj's sub-structure:
$('#foo', $('<div id="foo"><span/></div>')); // returns empty jquery object
So looking for #weblogs in the substructure of an element with id weblogs will also never find anything.
Your question isn't entirely clear, but I'll try and answer: are you working with Internet Explorer? If so, consider this paragraph from the docs:
For example, Internet Explorer sometimes leaves off the quotes around attribute values if they contain only alphanumeric characters.
API docs: html()