laravel maatwebsite/excel download excel to pdf - excel

how could i transform the file to pdf
i already tried change extension name but the image will disappear and excel format will shift
so is there any good idea can transform the file and at the same time could save the image and format?
here is my export code
my maatwebsite package does not have the create method.
public function export(Order $order)
{
return Excel::download(new OrderExport($order), $order->no.'.xlsx');
}
and the excel file will look like
excel file
if i transform it will be likeenter image description here

We had a similar problem but with word files.
We came to the conclusion that using the lowriter from LibreOffice will do the trick.
Option 1
In addition we used the use TitasGailius\Terminal\Terminal; library for easy Terminal use.
$export_path is the path where your excel file is
$file is the name of your file
$resp = Terminal::in($export_path)->run('lowriter --headless --convert-to pdf '.$file);
Option 2
Using some built in functionality of the Excel package.
Excel::create('Filename', function($excel) {
})->export('xls');
https://docs.laravel-excel.com/2.1/export/export.html

Related

Not able to download Suitelet through suitescript 1.0

I have created a button to export the form data to simple Excel.
Everything is working file, even if i try to save this excel file in the file cabinet it gets saved correctly.
But when i try to downlaod the excel file, downloads wierd single cell file with special characters or system gives either an error or saves an empty excel file.
Can anyone help me in how to download the excel file from button click. I think i have issue in my responce.
My Code example is as follows:
.
.
.
xmlString += '</Table></Worksheet></Workbook>';// this is my xml string
var xlsFile = nlapiCreateFile('test.xls', 'EXCEL', nlapiEncrypt(xmlString, 'base64'));
response.writeFile(xmlFile);
}
error screenshot:
I think the reason for the response issue is because you are calling a non-existent variable "xmlFile" in writeFile();
try using this writeFile(xlsFile);

Reading xls file is returning html tags using library xlsx

I am using xlsx library of nodejs for reading xls file. According to the document the library supports xls file format. On reading I am getting html tags along with it.
I can remove the html tags using regex or replace function but does the library give support to do that as I couldn't find it in the documentation?
Excel File format: Microsoft Excel 97-2003 Worksheet (.xls)
The demo link they have provided in their documentation https://oss.sheetjs.com/sheetjs/ works but when I try to do the same with my code it doesn't give the desired result.
let xlsx = require('xlsx');
let fs = require('fs');
let workBookData = xlsx.readFile('data.xls'); // parses a file
console.log(workBookData);
Here is an image of the result I am getting.
This was an issue/bug in the library. A PR has been created for this and it will be fixed in the new version of the library.

Is there a way to name the file that is downloaded from a URL call in excel VBA

I am using this link to pull a csv file from Service now with excel vba
Shell ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url https://xxxxxxx.service-now.com/sys_report_template.do?CSV&jvar_report_id=676dbfdadb2637489ec9de1a489xxxxx")
It downloads the file directly to users downloads but I am wondering is there any way you can set the name of the downloaded file, kind of like save as function?
I think that you can use CURL
Download it here:
https://curl.haxx.se/windows/
This is the sample:
Shell("c:\curl.exe https://xxxxxxx.service-now.com/sys_report_template.do?CSV&jvar_report_id=676dbfdadb2637489ec9de1a489xxxxx -o output-name-xxxx.csv")
Hope it helps.

What .xlsx file format is this?

Using an existing SSIS package, I was trying to import .xlsx files we received from a client. I received the error message:
External table is not in the expected format
These files will open in XL
When I use XL (currently XL2010) to Save As... the file without making any changes:
The new file imports just fine
The new file is 330% the size of the original file
When changing .xlsx to .zip and investigating the contents with WinZip:
The original file only has 4 .xml files and a _rels folder (with 2 .rels files):
The new file has the expected .xlsx contents:
Does anyone know what kind of file this could be?
It would be nice to develop my SSIS package to work with these original files, without having to open and re-save each file. There are only 12 files, so if there are no other options, opening/saving each file is not that big of deal...and I could automate it with VBA going forward.
Thanks for any help anyone can provide,
CTB
There are many Excel file formats.
The file you are trying to import may have another excel format but the extension is changed to .xlsx (it could be edited by someone else) , or it could be created with a different Excel version.
There is a Third-Part application called TridNet File Identifier which is an utility designed to identify file types from their binary signatures. you can use it to specify the real extension of the specified file.
Also after a simple search on External table is not in the expected format this error is thrown when the definition (or version) of the excel files supported in the connection string is different from the file selected. Check the connection string used in the excel connection manager. It might help to identify the version of the file.

Upload and Save an excel file with BottlePy

I am creating an application using Bottle framework. I need a feature to upload an Excel file.
I am using the following for file upload.
http://bottlepy.org/docs/dev/tutorial.html#post-form-data-and-file-uploads
On the server side I am getting the file data as binary content. I want to save it in a temporary folder as an Excel file.
I am new to Python and Bottle. Any help will be much appreciated.
Thanks
Chirdeep
Your request.files.data object contains the data about your excel file. So you only need to create a temporary folder and save it inside. This can be done using the tempfile module
f = tempfile.NamedTemporaryFile(delete=False, suffix=".xlsx")
f.write(request.files.data.file.read())
f.close()
I was not able to get simple file writing code like yours to work, So I used the tempfile module. Looking at your code, I would have assumed it would write to the directory where the python file is, if the code is working. Try using the code below, if you don't pass arguments to dir, it will create a file in the current directory.
def save_as_temp_file(data):
with tempfile.NamedTemporaryFile(dir=settings.TEMP_PATH,
delete=False,
suffix=".xlsx") as f:
f.write(data.file.read())
return f.name

Resources