Funciones de conversion del Control actividades en Word a eXcel. Marcadores ¦ 166 (no ) y · 183, sin constantes por claridad del codigo.
Constantes
Real CwxWraReal CwxPixText CwxEtcText CwxTabText CwxWeeText CwxYeaText CwxMthText CwxDayVariables de control
Set CwxTreFunciones
Set CwxGetLines(Text inpTxt)Text CwxTimeIni(Text inpTab)Text CwxClsEndDot(Text inpLin)Text CwxTimeEnd(Text inpLin)Text CwxTimeFix(Text inpTxt)Text CwxTranslate(Text inpLin, Set cwxTra)Real CwxArial8CharWidth(Text oneChr)Real CwxArial8LineWidth(Text oneLine)Set CwxLineWrap(Text obsFld)Set CwxObservations(Text obsFld)Text CwxErrorRow(Text inpLin)Text CwxExcel(Text inpTxt)//////////////////////////////////////////////////////////////////////////////
Real CwxWra = 105;
//////////////////////////////////////////////////////////////////////////////
PutDescription("Caracteres de las observaciones.", CwxWra);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real CwxPix = 533;
//////////////////////////////////////////////////////////////////////////////
PutDescription("Pixeles de las observaciones.", CwxPix);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxEtc = "…";
//////////////////////////////////////////////////////////////////////////////
PutDescription("Indica que se ha trucado el texto al ser largo.", CwxEtc);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTab = Char(9);
//////////////////////////////////////////////////////////////////////////////
PutDescription("Tabulador para saltas celdas en Excel.", CwxTab);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxWee = Replace("=TEXTO(INDIRECTO('D' &FILA());'dddd')", "'", "\"");
//////////////////////////////////////////////////////////////////////////////
PutDescription("Codigo Excel del nombre del dia de la semana.", CwxWee);
//////////////////////////////////////////////////////////////////////////////
"
//////////////////////////////////////////////////////////////////////////////
Text CwxYea = Replace("=TEXTO(INDIRECTO('D' &FILA());'aa.mm')", "'", "\"");
//////////////////////////////////////////////////////////////////////////////
PutDescription("Codigo Excel del año con punto y el numero de mes.", CwxYea);
//////////////////////////////////////////////////////////////////////////////
"
//////////////////////////////////////////////////////////////////////////////
Text CwxMth = Replace("=TEXTO(INDIRECTO('D' &FILA());'mmmm')", "'", "\"");
//////////////////////////////////////////////////////////////////////////////
PutDescription("Codigo Excel del nombre completo del mes.", CwxMth);
//////////////////////////////////////////////////////////////////////////////
"
//////////////////////////////////////////////////////////////////////////////
Text CwxDay = FormatDate(If(Hour(Now)>=18, Today, Succ(Today, C, -1)),
"%c%d/%m/%Y"); //
//////////////////////////////////////////////////////////////////////////////
PutDescription("Hoy si es tarde o ayer si ahora es temprano.", CwxDay);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxTre = [[
[[ [["realizado¦", "Realizado¦"]], "¦" ]],
[[ [["¦ ", "¦,", "¦;", "¦.", " ¦", ",¦", ";¦", ".¦"]], "¦" ]] ]];
//////////////////////////////////////////////////////////////////////////////
PutDescription("Reglas de traduccion particularizables.", CwxTre);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxGetLines(Text inpTxt) // Texto de entrada
//////////////////////////////////////////////////////////////////////////////
{
Set setTok = Tokenizer(inpTxt, "\n");
Set cutCic = EvalSet(setTok, Text(Text txtTok)
{
Real tabPos = TextFind(txtTok, CwxTab);
Real cutPos = If(tabPos >= 1, tabPos + 1, 1);
Text cutTxt = Sub(txtTok, cutPos, TextLength(txtTok));
Compact(cutTxt)
});
Select(cutCic, Real(Text inpTok) { inpTok != "" })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Equivalente a Tokenizer() pero retorna los textos compactados y no vacios.",
CwxGetLines);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTimeIni(Text inpTab) // Linea de entrada
//////////////////////////////////////////////////////////////////////////////
{
Text inpLin = Sub(inpTab, TextFind(inpTab, CwxTab)+1, TextLength(inpTab));
Real linLen = TextLength(inpLin);
Text horSep = Sub(inpLin, 3, 3); // Para controlar si hay hora inicial
Real cutPos = If(horSep == ":", 7, 1); // Con o sin hora inicial
Sub(inpLin, cutPos, linLen)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Si hay una hora de inicio al principio la elimina.",
CwxTimeIni);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxClsEndDot(Text inpLin) // Linea de entrada ya compactada
//////////////////////////////////////////////////////////////////////////////
{
Real linLen = TextLength(inpLin);
Text dotCtr = Sub(inpLin, linLen, linLen); // Controla punto final
If(dotCtr != ".", inpLin, Sub(inpLin, 1, linLen-1))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Si hay un punto al final del texto lo elimina.",
CwxClsEndDot);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTimeEnd(Text inpLin) // Linea de entrada ya compactada
//////////////////////////////////////////////////////////////////////////////
{
Real linLen = TextLength(inpLin);
Real hasTim = And(Text Sub(inpLin,linLen, linLen) <: [["0","5"]],
Text Sub(inpLin,linLen-1,linLen-1) <: [["0","2","5","7"]];
Text Sub(inpLin,linLen-2,linLen-2) == ",");
If(!hasTim, inpLin+"¦0,25",
Sub(inpLin, 1, linLen-6)+"¦"+Sub(inpLin, linLen-3, linLen))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Pone un marcador en la duracion de la actividad que hay al final del texto y
si no hay duracion asume un cuarto de hora.",
CwxTimeEnd);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTimeFix(Text inpTxt)
//////////////////////////////////////////////////////////////////////////////
{
Set setLin = CwxGetLines(inpTxt);
Set cicLin = EvalSet(setLin, Text(Text inpLin)
{
Text timIni = CwxTimeIni(inpLin); // Quita las horas de inicio
Text endDot = CwxClsEndDot(timIni); // Quita los puntos finales
Text timEnd = CwxTimeEnd(endDot); // Separa y pone el tiempo dedicado
"·"+timEnd+"\n"
});
Replace(SetSum(cicLin), ";", ",") // Une y unifica ; x ,
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Trabaja sobre los tiempos y sobre los signos de puntuacion.",
CwxTimeFix);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTranslate(Text inpLin, // Texto de entrada
Set cwxTra) // Reglas de traduccion
//////////////////////////////////////////////////////////////////////////////
{
Text cwxRep = TxtReplaceTree(inpLin, cwxTra, 0); // Traducir
Replace(cwxRep, "·", "¦¦¦") // Poner vacios lo no traducido
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Aplica todas las reglas de traduccion de las anotaciones de actividad.",
CwxTranslate);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real CwxArial8CharWidth(Text oneChr) // Un caracter + su separacion
//////////////////////////////////////////////////////////////////////////////
{
Case(
oneChr<:[["i","l","|",".",",",";",":","!"]], 1,
oneChr<:[["j","í"," "]], 2,
oneChr<:[["[","]","{","}","(",")","/","\\"]], 3,
oneChr<:[["f","t","I","Í","r","-","*"]], 3,
oneChr<:[["x","y","c","s","J","k","v","=","<",">","+","F","Z","T"]], 5,
oneChr<:[["a","b","d","e","g","h","n","ñ","o","p","q","u","L"]], 5,
oneChr<:[["0","1","2","3","4","5","6","7","8","9","?"]], 5,
oneChr<:[["A","Á","E","É","U","Ú"]], 6,
oneChr<:[["X","B","K","P","S","V","C","D","H","N","Ñ","R"]], 6,
oneChr<:[["Y","G","O","Ó","Q","M","m",CwxEtc]], 7,
oneChr<:[["w","%"]], 9,
oneChr<:[[""]], 10,
oneChr<:[["W"]], 11,
TRUE, /* á, é, ó, ú, ... */ 5
)+1
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el ancho en pixels de un caracter en Arial de tamaño 8.",
CwxArial8CharWidth);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real CwxArial8LineWidth(Text oneLine) // Una linea
//////////////////////////////////////////////////////////////////////////////
{ SetSum(TxtForChr(oneLine, CwxArial8CharWidth)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el ancho en pixels de un texto en Arial de tamaño 8.",
CwxArial8CharWidth);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxLineWrap(Text obsFld)
//////////////////////////////////////////////////////////////////////////////
{
Set setWra = TxtLineWrap(obsFld, CwxWra, TRUE);
Text obsWra = setWra[1];
If(obsWra==obsFld, SetOfText(obsWra, ""), // Cabe
{
Real linWid = CwxArial8LineWidth(obsWra); // Ajuste Arial 8 proporcional
Real addChr = Round(Max(CwxPix - linWid - 7, 0) / 6);
Set newWra = TxtLineWrap(obsFld, TextLength(obsWra)+addChr, TRUE);
SetOfText(newWra[1] + CwxEtc, newWra[2]) // No cabe
})
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Version de la funcion TxtLineWrap() que realiza un mejor ajuste cuando el
tipo de letra no es de ancho fijo sino proporcional como la Arial.
Marca el texto con puntos supensivos cuando lo trunca.",
CwxLineWrap);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxObservations(Text obsFld)
//////////////////////////////////////////////////////////////////////////////
{
Text obsTUp = ToUpper(Sub(obsFld,1,1)) + Sub(obsFld,2,TextLength(obsFld));
CwxLineWrap(obsTUp)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una observacion con la mayuscula inicial y ajustado el texto al
ancho en pixels de la columna.",
CwxObservations);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxErrorRow(Text inpLin)
//////////////////////////////////////////////////////////////////////////////
{ Repeat(CwxTab, 8)+inpLin+"\n" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una fila Excel para el caso de error.",
CwxErrorRow);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxExcel(Text inpTxt)
//////////////////////////////////////////////////////////////////////////////
{
Set setLin = CwxGetLines(inpTxt); // Si se quitan las vacias
Set setSor = Sort(setLin, Compare);
Set cicLin = EvalSet(setSor, Text(Text inpLin)
{
Set setFld = Txt2Set(inpLin, "¦"); // No se quitan los vacios
If(Card(setFld) != 5, CwxErrorRow(inpLin),
{
Set obsSet = CwxObservations(setFld[4]);
Text obsWra = obsSet[1] + If(obsSet[2]=="", "", CwxTab+obsSet[2]);
setFld[1] + CwxTab + // Entidad
setFld[2] + CwxTab + // Codigo
setFld[3] + CwxTab + // Proyecto
CwxDay + CwxTab + // Fecha en formato d/m/y
setFld[5] + CwxTab + // Horas
CwxWee + CwxTab + // Dia de la semana
CwxYea + CwxTab + // Año con su mes en numero
CwxMth + CwxTab + // Nombre del mes
obsWra + "\n" // Observaciones
})
});
SetSum(cicLin)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un texto convertido en filas Ascii con tabs para pegar en Excel.",
CwxExcel);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FILE : cwx.tol
// AUTHOR : http://www.asolver.com
// PURPOSE : Funciones de conversion del Control actividades en Word a eXcel.
// Marcadores ¦ 166 (no ) y · 183, sin constantes por claridad del codigo.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// CONSTANTS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real CwxWra = 105;
//////////////////////////////////////////////////////////////////////////////
PutDescription("Caracteres de las observaciones.", CwxWra);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real CwxPix = 533;
//////////////////////////////////////////////////////////////////////////////
PutDescription("Pixeles de las observaciones.", CwxPix);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxEtc = "…";
//////////////////////////////////////////////////////////////////////////////
PutDescription("Indica que se ha trucado el texto al ser largo.", CwxEtc);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTab = Char(9);
//////////////////////////////////////////////////////////////////////////////
PutDescription("Tabulador para saltas celdas en Excel.", CwxTab);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxWee = Replace("=TEXTO(INDIRECTO('D' &FILA());'dddd')", "'", "\"");
//////////////////////////////////////////////////////////////////////////////
PutDescription("Codigo Excel del nombre del dia de la semana.", CwxWee);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxYea = Replace("=TEXTO(INDIRECTO('D' &FILA());'aa.mm')", "'", "\"");
//////////////////////////////////////////////////////////////////////////////
PutDescription("Codigo Excel del año con punto y el numero de mes.", CwxYea);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxMth = Replace("=TEXTO(INDIRECTO('D' &FILA());'mmmm')", "'", "\"");
//////////////////////////////////////////////////////////////////////////////
PutDescription("Codigo Excel del nombre completo del mes.", CwxMth);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxDay = FormatDate(If(Hour(Now)>=18, Today, Succ(Today, C, -1)),
"%c%d/%m/%Y"); //
//////////////////////////////////////////////////////////////////////////////
PutDescription("Hoy si es tarde o ayer si ahora es temprano.", CwxDay);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// CONTROLS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxTre = [[
[[ [["realizado¦", "Realizado¦"]], "¦" ]],
[[ [["¦ ", "¦,", "¦;", "¦.", " ¦", ",¦", ";¦", ".¦"]], "¦" ]] ]];
//////////////////////////////////////////////////////////////////////////////
PutDescription("Reglas de traduccion particularizables.", CwxTre);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxGetLines(Text inpTxt) // Texto de entrada
//////////////////////////////////////////////////////////////////////////////
{
Set setTok = Tokenizer(inpTxt, "\n");
Set cutCic = EvalSet(setTok, Text(Text txtTok)
{
Real tabPos = TextFind(txtTok, CwxTab);
Real cutPos = If(tabPos >= 1, tabPos + 1, 1);
Text cutTxt = Sub(txtTok, cutPos, TextLength(txtTok));
Compact(cutTxt)
});
Select(cutCic, Real(Text inpTok) { inpTok != "" })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Equivalente a Tokenizer() pero retorna los textos compactados y no vacios.",
CwxGetLines);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTimeIni(Text inpTab) // Linea de entrada
//////////////////////////////////////////////////////////////////////////////
{
Text inpLin = Sub(inpTab, TextFind(inpTab, CwxTab)+1, TextLength(inpTab));
Real linLen = TextLength(inpLin);
Text horSep = Sub(inpLin, 3, 3); // Para controlar si hay hora inicial
Real cutPos = If(horSep == ":", 7, 1); // Con o sin hora inicial
Sub(inpLin, cutPos, linLen)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Si hay una hora de inicio al principio la elimina.",
CwxTimeIni);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxClsEndDot(Text inpLin) // Linea de entrada ya compactada
//////////////////////////////////////////////////////////////////////////////
{
Real linLen = TextLength(inpLin);
Text dotCtr = Sub(inpLin, linLen, linLen); // Controla punto final
If(dotCtr != ".", inpLin, Sub(inpLin, 1, linLen-1))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Si hay un punto al final del texto lo elimina.",
CwxClsEndDot);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTimeEnd(Text inpLin) // Linea de entrada ya compactada
//////////////////////////////////////////////////////////////////////////////
{
Real linLen = TextLength(inpLin);
Real hasTim = And(Text Sub(inpLin,linLen, linLen) <: [["0","5"]],
Text Sub(inpLin,linLen-1,linLen-1) <: [["0","2","5","7"]];
Text Sub(inpLin,linLen-2,linLen-2) == ",");
If(!hasTim, inpLin+"¦0,25",
Sub(inpLin, 1, linLen-6)+"¦"+Sub(inpLin, linLen-3, linLen))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Pone un marcador en la duracion de la actividad que hay al final del texto y
si no hay duracion asume un cuarto de hora.",
CwxTimeEnd);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTimeFix(Text inpTxt)
//////////////////////////////////////////////////////////////////////////////
{
Set setLin = CwxGetLines(inpTxt);
Set cicLin = EvalSet(setLin, Text(Text inpLin)
{
Text timIni = CwxTimeIni(inpLin); // Quita las horas de inicio
Text endDot = CwxClsEndDot(timIni); // Quita los puntos finales
Text timEnd = CwxTimeEnd(endDot); // Separa y pone el tiempo dedicado
"·"+timEnd+"\n"
});
Replace(SetSum(cicLin), ";", ",") // Une y unifica ; x ,
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Trabaja sobre los tiempos y sobre los signos de puntuacion.",
CwxTimeFix);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxTranslate(Text inpLin, // Texto de entrada
Set cwxTra) // Reglas de traduccion
//////////////////////////////////////////////////////////////////////////////
{
Text cwxRep = TxtReplaceTree(inpLin, cwxTra, 0); // Traducir
Replace(cwxRep, "·", "¦¦¦") // Poner vacios lo no traducido
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Aplica todas las reglas de traduccion de las anotaciones de actividad.",
CwxTranslate);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real CwxArial8CharWidth(Text oneChr) // Un caracter + su separacion
//////////////////////////////////////////////////////////////////////////////
{
Case(
oneChr<:[["i","l","|",".",",",";",":","!"]], 1,
oneChr<:[["j","í"," "]], 2,
oneChr<:[["[","]","{","}","(",")","/","\\"]], 3,
oneChr<:[["f","t","I","Í","r","-","*"]], 3,
oneChr<:[["x","y","c","s","J","k","v","=","<",">","+","F","Z","T"]], 5,
oneChr<:[["a","b","d","e","g","h","n","ñ","o","p","q","u","L"]], 5,
oneChr<:[["0","1","2","3","4","5","6","7","8","9","?"]], 5,
oneChr<:[["A","Á","E","É","U","Ú"]], 6,
oneChr<:[["X","B","K","P","S","V","C","D","H","N","Ñ","R"]], 6,
oneChr<:[["Y","G","O","Ó","Q","M","m",CwxEtc]], 7,
oneChr<:[["w","%"]], 9,
oneChr<:[[""]], 10,
oneChr<:[["W"]], 11,
TRUE, "/* á, é, ó, ú, ... */ 5
)+1
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el ancho en pixels de un caracter en Arial de tamaño 8.",
CwxArial8CharWidth);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real CwxArial8LineWidth(Text oneLine) // Una linea
//////////////////////////////////////////////////////////////////////////////
{ SetSum(TxtForChr(oneLine, CwxArial8CharWidth)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el ancho en pixels de un texto en Arial de tamaño 8.",
CwxArial8CharWidth);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxLineWrap(Text obsFld)
//////////////////////////////////////////////////////////////////////////////
{
Set setWra = TxtLineWrap(obsFld, CwxWra, TRUE);
Text obsWra = setWra[1];
If(obsWra==obsFld, SetOfText(obsWra, ""), // Cabe
{
Real linWid = CwxArial8LineWidth(obsWra); // Ajuste Arial 8 proporcional
Real addChr = Round(Max(CwxPix - linWid - 7, 0) / 6);
Set newWra = TxtLineWrap(obsFld, TextLength(obsWra)+addChr, TRUE);
SetOfText(newWra[1] + CwxEtc, newWra[2]) // No cabe
})
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Version de la funcion TxtLineWrap() que realiza un mejor ajuste cuando el
tipo de letra no es de ancho fijo sino proporcional como la Arial.
Marca el texto con puntos supensivos cuando lo trunca.",
CwxLineWrap);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Set CwxObservations(Text obsFld)
//////////////////////////////////////////////////////////////////////////////
{
Text obsTUp = ToUpper(Sub(obsFld,1,1)) + Sub(obsFld,2,TextLength(obsFld));
CwxLineWrap(obsTUp)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una observacion con la mayuscula inicial y ajustado el texto al
ancho en pixels de la columna.",
CwxObservations);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxErrorRow(Text inpLin)
//////////////////////////////////////////////////////////////////////////////
{ Repeat(CwxTab, 8)+inpLin+"\n" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una fila Excel para el caso de error.",
CwxErrorRow);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text CwxExcel(Text inpTxt)
//////////////////////////////////////////////////////////////////////////////
{
Set setLin = CwxGetLines(inpTxt); // Si se quitan las vacias
Set setSor = Sort(setLin, Compare);
Set cicLin = EvalSet(setSor, Text(Text inpLin)
{
Set setFld = Txt2Set(inpLin, "¦"); // No se quitan los vacios
If(Card(setFld) != 5, CwxErrorRow(inpLin),
{
Set obsSet = CwxObservations(setFld[4]);
Text obsWra = obsSet[1] + If(obsSet[2]=="", "", CwxTab+obsSet[2]);
setFld[1] + CwxTab + // Entidad
setFld[2] + CwxTab + // Codigo
setFld[3] + CwxTab + // Proyecto
CwxDay + CwxTab + // Fecha en formato d/m/y
setFld[5] + CwxTab + // Horas
CwxWee + CwxTab + // Dia de la semana
CwxYea + CwxTab + // Año con su mes en numero
CwxMth + CwxTab + // Nombre del mes
obsWra + "\n" // Observaciones
})
});
SetSum(cicLin)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un texto convertido en filas Ascii con tabs para pegar en Excel.",
CwxExcel);
//////////////////////////////////////////////////////////////////////////////
Sfk.Diary conversor de notas escritas de Word a Excel a traves del clipboard
2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio