PHPExcel : Set header string in the first page only - phpexcel

The following line insert the string in the header of each printed page:
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('abcd');
When I try with this one, nothing is insert at all:
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setFirstHeader('abcd');
What is the best way to insert a string in the header of the first page only?
Thanks.

Related

Kibana 7.7.1 - saved search does not include search string quotations; escaping with %22 does not work

I tried to save a query with search query string like:
"order cancellation request received for userId = 123"
I need the whole string so I quote it with double quotations in the search bar. That query works but only until I save it and share the link.
When I save it with "Save" button top of search bar, or "disk" button at the left of search bar, the page reloads and my quotations are removed; now the results are not the same because the engine matches any of the words in the query and gets me more results.
When I check the url, I see this part:
...,query:(language:kuery,query:'order%20cancellation%20request%20received%20for%20userId%20%3D%20123'),...
Apparently, there are not quotations. So I tried to add %22 as how they should be encoded in URL, but no avail.
So, why? I expect Kibana to preserve the quotations in the search term.
Or, can someone suggests another kind of syntax which is valid, correct and shareable as an URL?
Nah. I found why.
You should add %22 inside 'xxxx' so that it would look like:
...,query:(language:kuery,query:'%22order%20cancellation%20request%20received%20for%20userId%20%3D%20123%22'),...

Show whitespace instead of after HTMLEncode

Looking at an old ASP file, I am trying to figure out what would the best practice be in achieving the following:
I am receiving a string through a database connection.
This string is the displayed part of a select box.
I am required to output this string using Server.HTMLEncode(string).
However, since there are spaces in that string I get the output as .
What would the best practice be in converting back into actual whitespace?
To replace with whitespace in classic ASP I used the following code:
<%= Replace(Server.HTMLEncode(string)," "," ") %>
Where string is the variable that contains .

How can I add a line break in a POST param value?

I'm trying to submit a POST request using "Form Url-Encoded" params. When the value contains empty spaces, PAW encodes with the "+" sigh correctly. But what about line breaks?
How can I put a line break in a parameter value? It's a parameter in the body of the post request.
Try putting in %0D%0A, which is the URL-Encoded representation of the line feed and carriage return characters, wherever you want a line break.
The easiest is probably to add that as a Custom Dynamic Value (right-click and pick from the menu: Extensions > Custom). And just returns a "\n" from JavaScript.
He's how it should be looking like:
The JavaScript code is:
function evaluate(context){
return "\n";
};
That should do the trick.

Converting HTML special characters in ASP.NET

I am binding to a DropDownList as follows;
Sub bindGalleries(ByVal catID As Integer)
ddlGalleries.DataSource = Galleries.GetGalleries(catID)
ddlGalleries.DataTextField = "GalleryName"
ddlGalleries.DataValueField = "GalleryID"
ddlGalleries.DataBind()
End Sub
One of the items in the list is: 'Kültür & Sanat', which is displayed just right in the dropdownlist. But when I look at the source of the page, it is: Kültür & Sanat
How can I get the source to be exactly the same as the original string?
Note: my meta tag is: in master page..
This should give you what you need:
Server.HtmlDecode("Kültür & Sanat");
Write a method to "sanitize" the items in the DDL and store them in an array. Then just bind to the array.
You can populate the DDL in a similar fashion.
You may be able to use backslashes to escape
Try to put the proper charset in the heading portion of your page.
Example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-16"/>
The reason why you see those characters is because those characters are being htmlencoded upon saving into your source.
i.e.
YourSource = server.htmlEncode(value)
or
YourSource = server.urlEncode
You can save it to its original form by using server.htmlDecode or by omitting the server.htmlEncode.

How do I identify the referrer page in ASP.NET?

In VS2003, I am trying to find out the particular page where the request is coming from. I want to identify the exact aspx page name.
Is there a way to only get the page name or some how strip the page name?
Currently I am using the following instruction...
string referencepage = HttpContext.Current.Request.UrlReferrer.ToString();
and I get the following result...
"http://localhost/MyPage123.aspx?myval1=3333&myval2=4444;
I want to get the result back with out any query string parameters and be able to identify the page MyPage123.aspx accurately...
How do I do that??
Instead of calling .ToString on the Uri, use the AbsolutePath property instead:
string referencepage = HttpContext.Current.Request.UrlReferrer.AbsolutePath;
This should get you "/MyPage123.aspx" in your case.
Edit: Had LocalPath instead of AbsolutePath by mistake
Look at the Segments property of the URI class (which is what HttpContext.Current.Request.UrlReferrer returns).
Something like HttpContext.Current.Request.UrlReferrer.Segments[1] (changing the 1 indexer to get the correct segment you require).

Resources