wkhtmltopdf in C# - for converting large number of html files with file name having spaces - wkhtmltopdf

I would like to convert large number of html files from a directory to PDF using C#.
How to pass input file name and output file name which contains spaces.
Eg wkhtmltopdf.exe 'test file.html' 'test file.pdf'
This is working using command prompt but not working in C#. Please help how to pass file names with spaces in it. The exe is taking spaces in file name as delimiter.

Related

Shell Script to Convert CSV to Text File

I need to create a shell script that reads a different folder based on today's date and inside the folder contains multiple files and one csv file that will have unique name everyday that is tab delimited. I want to pull this file and resave it as a text file.
Example of file path:
data/model/output20190725 (folder contains multiple files, new folder is created everyday)
-logfile1
-logfile2
-part3983isis4838.csv (this csv file will have a new and randomly generated name everyday, the csv file is also tab delimited)
I know how to go from a csv file to a text file, but I don't know how to add the logic of the folder name and the csv name changing everyday.
I saw that I could possibly use grep, but I don't know how to navigate to today's date folder and pull the csv and pass to the next argument to make the conversion.
grep -l .csv * |

Deleting and Replacing a file in shell command

I'm trying to replace a file once the OMC is set.
This code sets my "OMC" to the specific country code
Once this is done, I want to copy an xml file from a specific directory (this is just a random xml file I've edited with different parameters) and replace the original file in the OMC directory once the following script has detected the OMC.
In other words, to use an example, following this code I need to replace a file I have, let's just say, "temp/test.xml" to the directory "ABC/test.xml".
The "ABC/" directory will be the one the following the country code selected below.
getprop ro.boot.bootloader >> /tmp/BLmodel
ACTUAL_CSC=`cat /efs/imei/mps_code.dat`
ACTUAL_OMC=`cat /efs/imei/omcnw_code.dat`
SALES_CODE=`cat /system/omc/sales_code.dat`
sed -i -- "s/CSC=//g" /tmp/aroma/csc.prop
NEW_CSC=`cat /tmp/aroma/csc.prop`
buildprop=/system/build.prop

How to change Output File FG/BG Color generated from Bash Script (vimdiff)

I am differentiating two CSV files and generating its output in one html file by using below query:
vimdiff Sheet1.csv Sheet2.csv -c TOhtml -c 'w! CsvResult.html' -c 'qa!'
In above cmd two csv files (sheet1 and sheet2) in my Windows desktop, and CsvResult.html is a file which will show the output of both CSV's in html format.
The HTML file(CsvResult.html) which is generating is not visible properly because of different colors,
How to change generated HTML file FG/BG/Text color ? I tried using cmds for text change but it is not applying with file generated.

Bash Script to read CSV file and search directory for files to copy

I'm working on creating bash script to read a CSV file (comma delineated). The file contains parts of names for files in another directory. I then need to take these names and use them to search the directory and copy the correct files to a new folder.
I am able to read the csv file. However, csv file only contains part of the file names so I need to use wildcards to search the directory for the files. I have been unable to get the wildcards to work within the directory.
CSV File Format (in notepad):
12
13
14
15
Example file names in target directory:
IXI12_asfds.nii
IXI13_asdscds.nii
IXI14_aswe32fds.nii
IXI15_asf432ds.nii
The prefix to all of the files is the same: IXI. The csv file contains the unique numbers for each target file which appear right after the prefix. The middle portion of the filenames are unique to each file.
#!/bin/bash
# CSV file with comma delineated numbers.
# CSV file only contains part of the file name. Need to add IXI to the
beginning, and search with a wildcard at the end.
input="CSV_file.csv"
while IFS=',' read -r file_name1
do
name=(IXI$file_name1)
cp $name*.nii /newfolder
done < "$input"
The error I keep getting is saying that no folder with the appropriate name is able to be identified.

How to convert .csv to .xls

I have a simple .csv file.
Is it possible to convert it to .xls using the command line tool ssconvert?
I would also need to specify the name of the sheet.
ln -s input.csv MySheetName
ssconvert MySheetName output.xls
The OP asked how to convert csv to xls while controlling the sheet name in the output.
The generated .xls file will use the name of the input CSV file as the sheet name, so you can symlink the .csv to anything you want (or rename the input file) to produce the desired result.
The previous answer implies that --list-exporters leads to a solution, but it merely lists exporter names with no information about their options, and no options are documented in the man page for xls-exporters. Experimentally, none of the exporters which can create .xls accept options (they fail with "The file saver does not take options" if you use -O).
Yes, it is possible.
You must specify names with extensions as input and output files.
For example:
ssconvert in.csv out.xls
Using --list-importers and --list-exporters options can take a look to available formats.

Resources