How to get phpspreadsheet to fit to page when there is extra space - phpspreadsheet

I have a excel sheet that i'm trying to convert into a pdf. However, whenever I try to use Mpdf, the pdf looks like this.
I get a similar result when using Dompdf:
I've already tried using setFitToPage(1),
setFitToWidth(1),
setFitToHeight(0), and
setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER). Does this have to do more with the excel, or can something be done in phpspreadsheet?

Sometimes there are non visible Characters in a cell. You can try to delete a Colums F-K from your template.

Related

ImportXML not returning entire table

I cannot get an entire table to populate with ImportXML. At best I get the first column and I cannot figure this out.
The website I am trying to scrape is: https://classic.warcraftlogs.com/character/us/kromcrush/chills
Do I have any options to retrieve the table rather it be column by column or as a whole?
I have tried all the following plus several others.
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills","//table[#id='boss-table-1010']/tbody/tr")
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills","//tbody/tr")
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills","//tbody/tr/td")
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills","//tr")
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills","//tr/td")
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills","//tr/td[1]")
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills","//tr/td[2]")
Anything outside of column one says Imported content is empty. Please help!
P.S. I have scoured this website and google for answers and every case I find seems to be a syntax error, starting at the table itself doesn't return the entire table which tells me I need a clever method.
It seems that's an issue with the website, because when you click on Inspect you can see the table with id "boss-table-1010" but if you click on View Source that ID is not available, so the table is dynamically rendered and Sheets doesn't find such id.
I've checked it and I can get the data by doing
=IMPORTXML("https://classic.warcraftlogs.com/character/us/kromcrush/chills", "//table/tbody//td")
But if you want a more robust solution, it'll be better doing it programmatically by using Python for web scraping

Attempting to import from a XPath, seems to always yield blank information

Currently in my google doc, i'm working on a database for my card worth, and it seems like it doesn't want to grab the information no matter what xpath i want to attempt.
Website i'm trying to take information available here. *This is the hyperlink i'm feeding
In the top right corner i'm attempting to grab the worth box information, here is current xpaths i've attempted
"//a[#id='worthBox']/h4"
"/html/body/div[4]/div[1]/div[2]/form/div[1]/div[2]/div/a/h4"
"/h4"
"/h4[0-20]"
"//a[#id='worthBox'][1]/h4"
"//div[#id='estimate-box']/a/h4"
"//div[#id='estimate-box']/a[1]/h4"
Can someone explain to me why it doesn't seem to wanna fetch, is it even possible?
Thank you so much for your time and help!
In the URL, the value is put using the Javascript. But IMPORTXML cannot retrieve the result after Javascript was run. IMPORTXML retrieves the HTML without running Javascript. I think that your xpath is the result after Javascript was run. By this, they cannot be used. But it seems that the value you expect can be retrieved other xpath.
Modified xpath:
//input[#id='medianHiddenField']/#value
Sample formula:
=IMPORTXML(A1,"//input[#id='medianHiddenField']/#value")
In this case, the URL of https://mavin.io/search?q=Lugia%20NM%209%2F111%20-PSA&bt=sold# put in the cell "A1".
Result:
Reference:
IMPORTXML

Excel Hyperlink Function - Display Nice Name?

I found this formula online. It takes a cell, and handles the hyperlink, based on the excel spreadsheet being in the root folder, so the files being hyperlinked are in that directory (or sub-directory). This is the formula:
=HYPERLINK(LEFT(CELL("filename"),FIND("|",SUBSTITUTE(CELL("filename"),"\","|",LEN(CELL("filename"))-LEN(SUBSTITUTE(CELL("filename"),"\",""))))) & C2)
I would like to have it say something like "Click Here to Open" or something nice. I can certainly handle that in another cell, if that would be easier, but I'm not seeing a way to do that. Anyone know how to handle this?
We don't want the users to see D:\blah\folder\filename.pdf
It looks messy and would like something nicer.
Thanks!
Nevermind. I found it was as simple as adding
,"nicename")
OR
,A2)
to get the name I want.
Duh.

EMS Advanced Data Export VCL - export to Excel with custom field names

I cant seem to figure this one out.
Exporting data to Excel works OK but I do not want to use the original table field names but ones of my choice.
Right now, the original field names get exported (with the data,of course). QExport4XLS1 is linked to the data-set. I tried to use qeCustomSource41 (custom source) and changing field names - it worked OK but no data got exported. Only the field names.
Does anyone know how to accomplish this ? I never used these components before, so I am just trying them out. The documentation is horrible.
It seems the only way to do this is through QExport4Dialog1 and not through QExport4XLS1.

extract text from word or pdf based on format (font name and size)

I need to parse large text (about 1000 pages of word or pdf document)and place some of the text inside this document into database fields
I found that the only thing I can distinguish the text I want to extract is the format , it is always "Helvetica-Condensed" size 12
can I do that ? I know how to use the string functions but what I should use to test the format ?
as I said the text is stored inside word document or PDF
if there is third party component can do no problem please refer it to me
Thanks
There is QuickPDF. The price is $249,00.
The other option is to code it yourself. The file specification is available online, and if your only trying to rip the text out of the document this should guide you most of the way.
The only thing to be careful of are documents which are built entirely from images. In that scenario (no matter what you use to read the file) you will also need an OCR type of application. To see if this is the case or not, open a sample of the type of file you are wanting to "extract" text from, select the text to copy then try to paste into notepad.

Resources